I would like my user to specify a few parameters in a form. These parameters
will be used in a query for my records. I want to disply what the query's
records in a report. I am having some trouble with displaying it on the
report. Any suggestions?
Thanks.
The below information assumes you wish to use a start and end date to
filter reords for a report. Make whatever changes you need.
Create an unbound form. Add 2 Text Controls.
Name one StartDate and the 2nd EndDate.
Add a command button.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In the query, in it's Date field's criteria line, write:
Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate
Next, code the main report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog
Code the main report's Close event:
DoCmd.Close acForm, "ParamForm"
To display the 2 criteria dates in the report, add an unbound text
control to the Report header.
Set it's control source to:
="For Sales between " & forms!ParamForm!StartDate " and "
forms!ParamForm!EndDate
When ready to run the report, open the report. The form will display
and wait for the entry of the dates. Click the command button and the
report will run without need for any further parameter entries. When
the report closes, it will close the form. The starting and ending
dates will appera in the report header.