A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access to nested subform values



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2005, 07:41 PM
Ellie
external usenet poster
 
Posts: n/a
Default Access to nested subform values

I cannot find any help on the syntax for getting the value contained within
the current form and its nested subforms to my OpenRecord 'where' clause. I
can only get values from the main forms data as in:

DoCmd.OpenReport stDocName, acPreview, ,"CompanyName =
Forms!BusinessForm!CompanyName.value"

I want to combine CompanyName with LastName to create the 'where' clause.
LastName is in the subform PersonForm which is in the subform
BusinessLocationSubform which is in the main form, BusinessForm.

Thank you for your help. I've spent the last three days looking for this
answer before mailing this group...Ellie

--
I greatly appreciate all the assistance this community provides.
  #2  
Old May 12th, 2005, 03:02 AM
jl5000
external usenet poster
 
Posts: n/a
Default

Try this syntax:

Dim strCriteria as String

strCriteria = "[CompanyName] = '" & Forms!BusinessForm!CompanyName & "'"

'If you are running the report from the businessForm then use this line
'instead of the one above:

strCriteria = "[CompanyName] = '" & Me.CompanyName & "'"

'To concatenate more values use:
strCriteria = strCriteria & _
" and [LastName] = '" & me!subformname!lastname & "'"

'and so on for all the fields you want filter...

DoCmd.OpenReport stDocName, acPreview, ,strCriteria

Make sure your report has the fields that you are including in your criteria,



--
jl5000
a href="http://www.joshdev.com"/a


"Ellie" wrote:

I cannot find any help on the syntax for getting the value contained within
the current form and its nested subforms to my OpenRecord 'where' clause. I
can only get values from the main forms data as in:

DoCmd.OpenReport stDocName, acPreview, ,"CompanyName =
Forms!BusinessForm!CompanyName.value"

I want to combine CompanyName with LastName to create the 'where' clause.
LastName is in the subform PersonForm which is in the subform
BusinessLocationSubform which is in the main form, BusinessForm.

Thank you for your help. I've spent the last three days looking for this
answer before mailing this group...Ellie

--
I greatly appreciate all the assistance this community provides.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is a French Spellchecker a "required" update for English speak French Spellcheck Required? General Discussion 23 April 26th, 2005 01:17 AM
Setting values in a subform GeorgieGirl Using Forms 3 April 2nd, 2005 01:01 AM
How to display list box values in data access page? rebecca2001 Using Forms 1 December 15th, 2004 10:05 PM
Access 2000 -vs- Access 2003? Mark General Discussion 5 November 30th, 2004 06:36 AM
Access XP Compared to Access 2003 Mardene Leahu New Users 1 October 1st, 2004 05:11 AM


All times are GMT +1. The time now is 04:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.