Alan,
Thanks for the further explanation.
Here's how I would go about it... Set the Record Source of the report
to be the query with no criteria entered, and then use the Where
Condition argument of the OpenReport action in your macro(s) to restrict
the report's data according to the dates. This would involve triggering
the printing of the report from an event on a form. For example, you
could do it like this... Put an unbound Option Group on a form, with an
option for each pre-determined date range you need, for example "last
month", and another for "custom dates". If the user selects custom
dates, a couple of unbound textboxes become visible on the form to enter
the required date range. Then you have a command button with a macro on
the Click event to print the report. In the macro, use an OpenReport
action to correspond with each Option Group option, defined by a
Condition in the macro design. For example...
Condition: [YourOptionGroup]=1 '(last month)
Action: OpenReport
Report Name: YourReport
Where Condition: [YourDateField] Between
DateSerial(Year(Date()),Month(Date())-1,1) And
DateSerial(Year(Date()),Month(Date()),0)
Condition: [YourOptionGroup]=3 '(custom)
Action: OpenReport
Report Name: YourReport
Where Condition: [YourDateField] Between [Forms]![YourForm]![DateFrom]
And [Forms]![YourForm]![DateTo]
--
Steve Schapel, Microsoft Access MVP
Yes the original is set up to prompt, but I want to add a marcro that runs
the same report (which runs the query with the params in the criteria) on a
regular basis with the start and end dates automatically calculated (e.g 1st
and last days of last month). I have made a copy of the db and linked in the
source tables and modified my criteria for the expression to get 1st and last
days, but now I have to maintain 2 sets of virually identical queries and
reports. Would like to simply add the macro that passes values to the
criteria and get back to the one db.
Alan
: