I want to place a second report in a existing report. The
reports are based on a parameter query. The information
that is prompted for is the same on both reports, a date
range. When I put the second report in the exisiting
report it always prompts me for the dates twice when I
run the report. Is there anyway around this?
Create an unbound form. Add 2 Text Controls.
Name one StartDate and the other EndDate.
Set their Format property to a Date format.
Add a command button.
Code the button's click event:
Me.Visible = False
Name this form 'ParamForm'.
In each 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"
If you also wish to actually show the date range in the main report,
add an unbound 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.