We help IT Professionals succeed at work.

access 2010 form    DoCmd.OpenReport with argument

peispud
peispud used Ask the Experts™
on
Hi.

I am using Access 2010

I have a form and a report.

From the form,  I can use the following code and it works fine.

'DoCmd.OpenReport "Report", acViewPreview, , "[Packing Slip Ref Num]= '" & Me.[Packing Slip Ref Num] & "'"


I am having trouble in figuring out how to pass a string value to the "Report Open Event"  so that I can affect the Report Header text.

I appreciate any help.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2013
Commented:
Use the OpenArgs parameter:

DoCmd.OpenReport "Report", acViewPreview, , "[Packing Slip Ref Num]= '" & Me.[Packing Slip Ref Num] & "'", OpenArgs:="Your string"

Open in new window



and in the open event of the report:

Me.txtMytextbox = Me.Openargs

Open in new window

peispudTech

Author

Commented:
Thank you very much