Same Query, Different Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several reports based upon the same query that present data in
different ways. For example, Detail for past month, Summary for past year,
Summary by salesman for past quarter, etc.

Currently my query selects the date as "Between [StartDate] and [EndDate]"
and everything is working well with the user entering the StartDate and
EndDate when prompted.

I want each report to automatically calculate the StartDate and EndDate
parameters required by the report without user interaction. Is it possible to
do this and how would I go about it?
 
To get the start of the previous month, you can use DateSerial(Year(Date()),
Month(Date()) - 1, 1). To get the end of the previous month, you can use
DateSerial(Year(Date()), Month(Date()), 0)

To get this month last year, you can use DateSerial(Year(Date()) - 1,
Month(Date()), 1) to DateSerial(Year(Date()) - 1, Month(Date()) + 1, 0)

What else do you need?
 
I understand the DateSerial function. However what I am trying to do is have
each individual report pass their specific parameters to the underlying
query. Can this be done?

Is there some way that the parameters of a query can be set in the report
and passed to the query? or, is there a VBA way to set the parameters and
then call the report?
 
I don't believe there is any such capability natively.

Yes, you can set parameters in VBA.
 
Back
Top