How to search in a date field ?

  • Thread starter Thread starter SpookiePower
  • Start date Start date
S

SpookiePower

I have a field in my table of the type date - Long date.

I want to search the table by month and year, but I
dont know how to search in a date field using sql.

My first idea was to make a field called day, one called
month and one call year. And when I should search for
some data I would do it this way -
WHERE month = 05 AND year = 2006
But if I want to use and search the date field, how can I then do it ??
 
SpookiePower said:
I have a field in my table of the type date - Long date.

I want to search the table by month and year, but I
dont know how to search in a date field using sql.

My first idea was to make a field called day, one called
month and one call year. And when I should search for
some data I would do it this way -
WHERE month = 05 AND year = 2006
But if I want to use and search the date field, how can I then do it ??


Another way is to add a calculated field to the query:
Format(datefield, "mm/yyyy")
And use the criteria:
"05/2006"
 
Back
Top