open report by form field vale

naobao

Registered User.
Local time
Today, 02:44
Joined
Feb 13, 2014
Messages
99
Hi,

I want to open report by a from button,
the report name is base on a subform field value,
How can I do this?

Thanks!
 
in the query, set it to look at the subform value.
Use the FULL path....use the BUILDER to get it right.

select * from table where [field] = forms!myForm!subForm.form.txtBox
 
in the query, set it to look at the subform value.
Use the FULL path....use the BUILDER to get it right.

select * from table where [field] = forms!myForm!subForm.form.txtBox

like this??

DoCmd.OpenReport "forms!check_out_2_main!subForm.check_out_detail.SHIPMENT NO", acViewPreview, "", "", acNormal

But it not work...
 
Last edited:
NO

Assuming your subform control is actually called subform....

Code:
Dim strText As String
strText=Me.subForm.check_out_detail.Form.SHIPMENT NO

DoCmd.OpenReport strText, acViewPreview

You don't need the acNormal as its the default

OR to filter by a specific field and filter criteria, something like
Code:
DoCmd.OpenReport strText, acViewPreview, , "FieldName='" & FilterCriteria & "'"

HTH
 
NO

Assuming your subform control is actually called subform....

Code:
Dim strText As String
strText=Me.subForm.check_out_detail.Form.SHIPMENT NO

DoCmd.OpenReport strText, acViewPreview

You don't need the acNormal as its the default

OR to filter by a specific field and filter criteria, something like
Code:
DoCmd.OpenReport strText, acViewPreview, , "FieldName='" & FilterCriteria & "'"

HTH

THIS PART OF CODE IN RED

"strText=Me.subForm.check_out_detail.Form.SHIPMENT NO"

MAY BE HAVE MISTAKE?
 
Apologies
As you have a space in Shipment No, it needs []

strText=Me.subForm.check_out_detail.Form.[SHIPMENT NO]
 

Users who are viewing this thread

Back
Top Bottom