Code for Report (1 Viewer)

stevemccauley

Registered User.
Local time
Today, 11:02
Joined
Aug 8, 2001
Messages
75
I would like to have a query run for my report with the "AutoNumber" of the open form as the main grouping link when the print button is pressed. What type of code do I need to enter, and where?

Thanks,
Steve
 

Travis

Registered User.
Local time
Today, 03:02
Joined
Dec 17, 1999
Messages
1,332
Reference the forms Field in the Query's Criteria

=Forms![Formname].[AutonumberFieldname]
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:02
Joined
Feb 19, 2002
Messages
43,457
Another way to do this which will give you more flexibility is to use the where arguement of the OpenForm Method. Filtering the report this way allows you to open the report from multiple places without having a problem caused by its query referencing a particular form.
 

Users who are viewing this thread

Top Bottom