Query by Year?

P

pfm721

I have a table with a DOB field. What I need to do is look for records older
than 65 years by querying that field. What would be the proper way to go
about it? The field is in DD/MM/YYYY format. For instance I would like to
search for stuff before 1943. Thanks
 
P

pietlinden

I have a table with a DOB field. What I need to do is look for records older
than 65 years by querying that field. What would be the proper way to go
about it? The field is in DD/MM/YYYY format. For instance I would like to
search for stuff before 1943. Thanks

SELECT...
FROM ...
WHERE Year([DOB])<1943;
 
J

John W. Vinson/MVP

I have a table with a DOB field. What I need to do is look for records older
than 65 years by querying that field. What would be the proper way to go
about it? The field is in DD/MM/YYYY format. For instance I would like to
search for stuff before 1943. Thanks

Those are actually two slightly different criteria! Do you want
records for people who were born before January 1, 1943? Or people who
are over 65 years old today - using their birthday?

To get records prior to January 1 of 65 years ago, try a criterion on
DOB of

< DateSerial(Year(Date()) - 65, 1, 1)

For people past their 65th birthday, use

< DateAdd("yyyy", -65, Date())
 

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

Top