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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |