Using parameters with reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Used the instructions here:
http://office.microsoft.com/en-us/assistance/HA011170771033.aspx
to create a report that uses a form to feed parameters to a query that
outputs a report. Here's how it works:

-You open the report.
-Access processes the code attached to the report's Open event.
-That code opens a form that serves to collect the parameters.
-You enter the parameters and click OK.
-Access hides the form, but the form does not close.
-Access then processes the report's underlying query.
-That query retrieves parameters from the controls on the form that is
currently hidden, does its work, and then delivers its results to the report.
-The report finishes, and displays its results.
-When you close the report, code in the report's Close event also closes the
hidden form.

My issue is that the underlying query stays open after closing the report.
What do I need to do to have query close as well?
 
Find the line of code that opens the query, and either delete it or comment
it out. (Comment it out to begin with, at least until you've tested and are
sure that you have commented out the right line of code. You can always
delete it afterwards.) The query does not need to be open, that was just an
intermediate step in the example.

The line you're looking for looks something like this ...

DoCmd.OpenQuery "Sales By Category Query", acViewNormal, acEdit

(You may have changed the name of the query).
 
Back
Top