Criteria based on years

C

Chris

I am needing help with calculating my date criteria in a query.
At the beginning of each year (January), I will need to print a report
extracting data for the whole coming year.

I could have put as a criteria the following:
Between 01/01/07 And 31/12/07

This means that I would need to go and change the year at the beginning of
each year, which is not ideal. Is there a better way to do this?

Many Thanks,
Chris1
 
J

John Spencer

Try criteria of

Between DateSerial(Year(Date()),1,1) and DateSerial(Year(Date()),12,31)

or one that can be quite a bit slower is to use a calculated field to get
the year of the datefield match that against the year of the current date
Field: Year(YourDateField)
Criteria: Year(Date())



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
C

Chris

Thank you John, It is working a treat!

John Spencer said:
Try criteria of

Between DateSerial(Year(Date()),1,1) and DateSerial(Year(Date()),12,31)

or one that can be quite a bit slower is to use a calculated field to get
the year of the datefield match that against the year of the current date
Field: Year(YourDateField)
Criteria: Year(Date())



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Top