Code to adjust query criteria

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

Guest

Currently I have a switchboard for printing reports that track performance
over:
1. the current month
2. the previous 90 days
3. the current year

The way I am doing this is by creating 3 different queries for those time
periods and referencing those to create the 3 different reports via 3 control
buttons.
(ie. >=DateSerial(Year(Date()),1,1) - for current year)

I think I can better do this by writing code for the 3 control buttons and
automatically setting the 3 different criterias for the queries. Problem is
I don't know how to do this. Can anyone please help?

TIA
 
If the filter are used for reports, you can use the WhereCondition section on
the OpenReport command line

Dim MyCondition As String
MyCondition = "Year([DateFieldName]) = " & Year(Date())
Docmd.OpenReport "ReportName" , , , MyCondition
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top