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

report to open after query

Status
Not open for further replies.

fishtek

Technical User
Aug 21, 2002
56
US
Hello:
I have a buttons on a switchboard that open various search queries in design view. These queries retreive info for various reports. I would like to have the respective report open as soon as the user is done entering criteria and closes/saves the query. In other words, I would like the user to have the report pop up as soon as the query is to their liking without having to go look for the report. Any help would be much appreciated.
Thanks
 
You have the queries open in Design view. Why? Are they going to change criteria? Then why don't you change them to parameter prompts? By the way, when you save a select query you do not save the resultant answer.
Or, if they for some reason must look at the query result, place a macro a command button that first runs the query - it will show the resultant recordset - then when they close it the macro can run the report. Two Actions, OpenQuery and OpenReport.
If they were parameter prompts, they could just open the report. First they're prompted for criteria, the query runs, the report is created.
 
This is just a quick thought. No testing involved at all...so dont think I've done this before. =]

Anyway, I would try making a Form level variable on your switchboard - a boolean value, and name it something like bolOpenReport, and a string for the report name - strReport.

When you open the query in design view on the switchboard, set bolOpenReport to True, and set strReport to the cooresponding report name.

Then make a sub routine on the event Form_OnActivate with something like:
If bolOpenReport Then
DoCmd.OpenReport strReport,acViewPreview
bolOpenReport = False
End If

Keep in mind, since its on activate if they were to see the switchboard under the design view of the query and click on it, then it would open the report still.

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top