Report Query by Form

Wayne Cramer

Registered User.
Local time
Yesterday, 18:54
Joined
Aug 10, 2007
Messages
93
I have a report that I would like to pass parameter information by form. I have created the form and placed the parameter information in the query [Forms]![Form Name]![Field] and placed the following code in the open event of the report:
Private Sub Report_Open(Cancel As Integer)
bInReportOpenEvent = True
DoCmd.OpenForm "CMER", , , , , acDialog
bInReportOpenEvent = False
End Sub
The form works great and opens the query when I select a region manager. When I open the report it brings up the form...but when I enter the reion manager it opens the query but then brings up the parameter dialog asking for the regional manager again.
Another report using the same standards works perfectly. Well, almost perfectly. When the report is closed the query remains on the screen and has tyo be closed seperately - an annoiance to my users. Is there a way to close the underlying query with the report?
 
You don't need the reports underlying query open. Just open the report. Make sure you have the form open before you open the report, otherwise you will get the pop ups.
 
Query by form for report

How do I do that? The form is just a combo box with OK and Cancel buttons. Teh combo is attached to the paramer of the query. The open event on the report opens the form so I'm confused as to how I would open the form first.
 
Put a button on the form to open the report.
 

Users who are viewing this thread

Back
Top Bottom