Date Range for Reports

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

Guest

I have a button on a form that opens 3 reports. Each report needs to be
filtered by different date ranges. I can set up each one with a query
criteria of [Enter End Date] and [Enter start date], but this would have the
user putting in 6 dates...I'd prefer to have the report filter automatically.


For example, report only if a Test Date was within 60 days of today, a
Medication was within 120 days of today, etc...

Any thoughts?
 
Then just change the criteria in your query.

For "within 60 days of today" use >Date()-60

For within 120, use >Date()-120

etc.
 
I'm not sure if that what you are looking for, but try this

Select * From TableName Where [Test Date] Between DateAdd("d",-60,Date())
and Date()

Select * From TableName Where [Medication] Between DateAdd("d",-120,Date())
and Date()
 
To correct myself

Select * From TableName Where [Test Date] Between Date() And
DateAdd("d",60,Date())


Select * From TableName Where [Medication] Between Date() And
DateAdd("d",120,Date())


--
I hope that helped
Good luck


Ofer said:
I'm not sure if that what you are looking for, but try this

Select * From TableName Where [Test Date] Between DateAdd("d",-60,Date())
and Date()

Select * From TableName Where [Medication] Between DateAdd("d",-120,Date())
and Date()

--
I hope that helped
Good luck


5843 said:
I have a button on a form that opens 3 reports. Each report needs to be
filtered by different date ranges. I can set up each one with a query
criteria of [Enter End Date] and [Enter start date], but this would have the
user putting in 6 dates...I'd prefer to have the report filter automatically.


For example, report only if a Test Date was within 60 days of today, a
Medication was within 120 days of today, etc...

Any thoughts?
 
Back
Top