Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Second SubForm. 1

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi,
I'm trying to get a report to open from a check box on a second subform with this code I got from:



docmd.OpenReport "ReportReviewLetters", acViewPreview, "", "[Pay Number]= Me!FormQuerySubStaffLookup.form!FormQuerySubStaffLookUpAssSub.form!text1 "

It looks to be ok but it's not opening the report with the criteria.

Thanks in advance.
 
you're not concatenating correctly...

if your criteria is a string then,

"[Pay Number]= '" & Me!FormQuerySubStaffLookup.form!FormQuerySubStaffLookUpAssSub.form!text1 & "'"


if numeric (which payNumber probably is)

"[Pay Number]= " & Me!FormQuerySubStaffLookup.form!FormQuerySubStaffLookUpAssSub.form!text1

 
Hi Zion,
Pay number is a text field as the first digit is a letter.

I'm getting a message box "Access cant find the field FormQuerySubStaffLookup referred to in your expression" with this:

"[Pay Number]= '" & Me!FormQuerySubStaffLookup.form!FormQuerySubStaffLookUpAssSub.form!text1 & "'"

The form names are:

FormQueryMain: Main Form.
FormQuerySubStaffLookup: SubForm 1.
FormQuerySubStaffLookUpAssSub: SubForm 2.



 
Hi again,
I changed it to reference the main form.

Me.Parent.Parent!Text1

Thanks.
 


With quotes off course,

"[Pay Number]= '" & Me.Parent.Parent!Text1 & "'"

thanks Zion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top