I have a query with a date range hard coded for report proceedures. Well part
of the problem when having users manually selecting dates, it has to be done
multiple times. Is there a way that you only have to enter the date once?
Thanks,
Lee
Your running multiple reports and want the same dates on all of them.
Is there alway one report that is run first and one report that is run
last? If so ...
Create an unbound form.
Add 2 unbound text controls to the form.
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 each query's date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate
Next, code the first report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog
Code the close event of the last report to run:
DoCmd.Close acForm, "ParamForm"
When ready to run the report(s), open the report.
The form will open and wait for the entry of the starting and ending
dates wanted.
Click the command button and the report will run.
As long as this form is open, the dates will be accessible to any
query.
When that last report closes, it will close the form.
If the reports are run in a random order, open change the Click event
on the form from Me.Visible = False to:
DoCmd.Close acForm, Me.Name
Do NOT code the Open or Close event (as shown above) of any of the
reports.
Simply open this form, enter the dates, DO NOT CLICK the command
button. Click the form's Minimize button.
The form will be open but hidden, until you manually close it by
re-showing it and clicking it's command button.