I need a query which shows me the data in my table where the date field is between last month and 24 months ago
For example, since today is 5/17/2011, I need date between 5/1/2009 and 4/30/2011.
The hard part is, I need it to be coded to do this no matter what month I run it in...so next month would be between 6/1/2009 and 5/31/2011.
Make sense?
I know how to do the most recent date [ DateSerial(Year(Date()), Month(Date()+1), 0) ] , just not the one 24 months ago.
Thanks!
Morgan
Date Math
-
- Administrator
- Posts: 78464
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Date Math
Try
Between DateSerial(Year(Date())-2, Month(Date()), 1) And DateSerial(Year(Date()), Month(Date()), 0)
or
Between DateSerial(Year(Date())-2, Month(Date()), 1) And Date()-Day(Date())
Between DateSerial(Year(Date())-2, Month(Date()), 1) And DateSerial(Year(Date()), Month(Date()), 0)
or
Between DateSerial(Year(Date())-2, Month(Date()), 1) And Date()-Day(Date())
Best wishes,
Hans
Hans