Date Issue

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?
 
V

Van T. Dinh

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)
 
D

DavidW

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
 

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

Top