On Sun, 25 May 2008 13:07:58 -0700 (PDT), Brett wrote:
Hello,
Is it possible to have just one criteria and have it apply to a group
of queries?
I am trying to create a report with the separate results of 4 queries
based on a prompt for the user to input (only once) a date. Is this
something that I program into the report?
Also, this is related but may require a separate posting, but can I do
this with a list box for the user to select a choice, such as
LastMonth, LastWeek, etc.?
Thanks for your help in advance,
Brett
It's not clear to me if you are running 4 different reports base on 4
different queries, or 1 report based upon 4 different queries.
The below assumes 4 reports. Just modify it if it is one report.
You'll need to use a form to do this.
First, create a query that will display the fields you wish to show in
the reports.
Second, create a report, using the query(ies) as it's record source,
that shows the data you wish to display for ALL records.
Next, make a new unbound form.
Add 2 unbound text controls to the form.
Set their Format property to any valid date format.
Name one "StartDate".
Name the other "EndDate".
Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"
Go back to the query.
As Criteria on the DateField, write:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate
Do the same for each query that is used in each of the reports.
Then on the first report that is run, code that Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog
On the final report that is run, code that Report's Close event:
DoCmd.Close acForm, "ParamForm"
Run the first Report.
The report will open the form.
Enter the starting and ending dates.
Click the command button.
The first Report will display just those records selected.
Open each additional report in this series.
When the final Report closes it will close the form.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail