printing report with parameters

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

Guest

A report is based on a query. The query has a parameter set to prompt for the
start and end dates. When opening the report, the prompts appear and dates
are entered and the report displays as it should. When using the print
command from the menu, the parameter prompts once again appear and need to be
completed. Why would the second set of prompts be coming up?
 
A report is based on a query. The query has a parameter set to prompt for the
start and end dates. When opening the report, the prompts appear and dates
are entered and the report displays as it should. When using the print
command from the menu, the parameter prompts once again appear and need to be
completed. Why would the second set of prompts be coming up?

Use a form to enter the parameters, not the query prompt.

Create an unbound form.

Add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the entry of the starting and ending
dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
 
Back
Top