Date Issue

  • Thread starter Thread starter DavidW
  • Start date Start date
D

DavidW

I am using
(example)
Between DateSerial(Year(Date())-2,Month(Date()),Day(Date())) And
DateSerial(Year(Date())-1,Month(Date()),Day(Date()))
in a query to retrieve yearly records. I cascade the years by steping down
in the expression. Only one problem, the results is the year,or I get two
different years.

I think maybe it is using todays date to set the search criteria and then go
back from there.

Is there a way to set the begining and end of a year ,then step back in
every year from that point?
 
Not sure of the problem but if you want to select the *calendar* year, i.e.
01/Jan/RequiredYear and 31/Dec/RequiredYear, you ca use something like (e.g.
for last year):

Between DateSerial(Year(Date())-1, 1, 1)
And DateSerial(Year(Date())-1, 12, 31)
 
Thanks, That did the trick!
Van T. Dinh said:
Not sure of the problem but if you want to select the *calendar* year, i.e.
01/Jan/RequiredYear and 31/Dec/RequiredYear, you ca use something like (e.g.
for last year):

Between DateSerial(Year(Date())-1, 1, 1)
And DateSerial(Year(Date())-1, 12, 31)


--
HTH
Van T. Dinh
MVP (Access)



then
 
Back
Top