Date Criterion

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

DavidW

I have got a table that has a field that is a date stamp for when a record
is entered. I am trying to sort in a query by the current month and year
only, how do you specify the criterion for that?
 
Create 2 calculated fields along the lines of Month([DateField]) and
Year([DateField]) and set the criteria for them to Month(Date()) and
Year(Date()) respectively.

Alternatively, set the criteria for your DateField to Between
DateSerial(Year(Date()), Month(Date()), 1) And DateSerial(Year(Date()),
Month(Date()) + 1, 0)

If DateField has time in it as well, you'll want to change the end criteria
to DateSerial(Year(Date()), Month(Date()) + 1, 1)
 
Thanks Doug That Worked!
Douglas J. Steele said:
Create 2 calculated fields along the lines of Month([DateField]) and
Year([DateField]) and set the criteria for them to Month(Date()) and
Year(Date()) respectively.

Alternatively, set the criteria for your DateField to Between
DateSerial(Year(Date()), Month(Date()), 1) And DateSerial(Year(Date()),
Month(Date()) + 1, 0)

If DateField has time in it as well, you'll want to change the end criteria
to DateSerial(Year(Date()), Month(Date()) + 1, 1)

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



DavidW said:
I have got a table that has a field that is a date stamp for when a record
is entered. I am trying to sort in a query by the current month and year
only, how do you specify the criterion for that?
 
Back
Top