Date Functions

  • Thread starter Thread starter Haji
  • Start date Start date
H

Haji

Hello,

I need to run a series of rolling queries that will
capture transactions such as the last 60 day, Year to date
and last year - Year to date. So if today is 9/16/03 I
want to run two separate queries. One is sales year to
date. The other is sales from 1/1/02 to 9/18/02. I will
then compare the sales data based on customer number. But
I want this to be a rolling this where tomorrow it will
compare sales between 1/1/02 and 9/19/02. Can anyone
help?

Thanks,

Haji
 
So your criteria might be the following for the year to date comparison


SomeDate Between DateSerial(Year(Date()),1,1) and Date()

AND

SomeDate Between DateSerial(Year(Date())-1,1,1) and DateAdd("yyyy",-1,Date())

For 60 days,

SomeDate Between DateAdd("d",-60,Date()) and Date()
 
Back
Top