One report based on different queries

  • Thread starter Thread starter Wendy
  • Start date Start date
W

Wendy

Hi

I have a report which works fine and extracts data based on yesterday's
date. Now I need to be able to run the same report for a specific date the
user enters, but I also need to keep the 'yesterday' option..

The date field is used as an 'or' on 5 different fields in the query.

Can I change the reports source to run on whichever query determined by
whether the user enters a date or selects the yesterday option from a form?

I'm thinking possibly sql but my knowledge of writing sql is nil!

Can you point in me in the right direction please?

Thanks

Wendy
 
You should create a form with controls to enter dates. Then use references
to the controls in your one query that is used as the record source for the
report. Your criteria might have something like:

=Forms!frmDates!txtStartDate

Testing the same date against 5 different fields suggests your table(s)
might be un-normalized.
 
And to use Yesterday's date as the default, Make the Default Value of
txtStartDate, put this in the Default Value property"
=DateAdd("d", -1, Date())
 
Back
Top