Query year from a DD/MM/YYYY field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

easy question, I think:

want to query all 2004 entries from a DD/MM/YYYY field in a table

thanks in advance,

Josh
 
Josh said:
easy question, I think:

want to query all 2004 entries from a DD/MM/YYYY field in a table

Please explain first what a DD/MM/YYYY field is. Is it a text field that
happens to contain strings formatted like that to represent dates or is it
an actual DateTime field? The query would be quite different depending on
the answer to that question. Keep in mind that if its an actual DateTime
field the formatting is irrelevent to writing your query.

If it's a Text field...

SELECT * FROM TableName WHERE FieldName Like "*2004"

If it's a DateTime field...

SELECT * FROM TableName
WHERE FieldName BETWEEN #2004-01-01# AND #2004-12-31 23:59:59#
 

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

Similar Threads

printing report with date 3
Date format when exporting 2
Computing minutes, days and years 3
Change MM/DD/YYYY to MM/DD/YY 5
Text to date format? 0
Date of birth question 5
Dates in where clause 5
convert date 1

Back
Top