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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MULTIPLE QUERIES - ONE REPORT! 1

Status
Not open for further replies.

Angelique

Technical User
Mar 9, 2001
127
AU
I have three queries that have identical fields except I pass parameters:

1. Batch [Start No] to [End No].
2. Confirmation No [Confirmation No].
3. Date of Training [Start Date] to [End Date].

How can I use the same report?


Angelique
 
A slick way is to create a small form that offers the three choices, say in a list box. The user chooses one and then clicks an OK button. The cmdOK_Click procedure then assigns the name of the corresponding query to the Reports![ReportName].RecordSource property, then closes the form. (If the user didn't choose one before clicking OK, you instead just give them a message box and exit the Click procedure.) It's also nice to give the user a Cancel button. If they click that, set the report's RecordSource property to an empty string and close the form.

To integrate this into the report opening process, just have your Report_Open procedure open the form. Be sure to specify that you want it opened in dialog mode, so that the report will stop and wait for the user to choose. If you included a Cancel button on the form, then after doing the OpenForm (in Report_Open) you should check whether the RecordSource property is empty, meaning the user canceled the dialog form. If so, set the Report_Open's Cancel argument to true, then exit. The report will then just close down without displaying anything.

What the user will see, upon choosing the report (in either the Database Window or on a form that does OpenReport), is your little dialog form asking which records they want to see on the report. When they choose one and click OK, the report will open with a blank window, and then the query will ask for the parameters. After the parameters are entered, the report window will display the completed report preview. If the user clicked Cancel on the dialog, the dialog just disappears and the report never appears. Rick Sprague
 
Rick-

I have used several of your other suggesitons including this one about the report. You are great my friend, thanks for all the help!

Ed Almeida
"buzcut"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top