Parameter query for parts of date

  • Thread starter Thread starter Rose
  • Start date Start date
R

Rose

My date field is the traditional mm/d/yy format. I need to
create a parameter query that asks for the month and then
the year. I'm sure DatePart comes into this somewhere, but
wild guesses at the right way to word my criteria have failed.
 
Create a couple of calculated fields in your query, one to represent the
month and one for the year. You can either use DatePart, or the Month and
Year functions. Place your parameters relative to those computed fields.

The SQL would look something like:

SELECT Field1, Field2
FROM MyTable
WHERE Month(MyDate) = [Enter Month Number]
AND Year(MyDate) = [Enter Year]
 
Back
Top