Using dates for birthdates and finding people under certain age

G

Guest

I have a table with a list of names and their birthdates. The birthdate field
is a date/time field with an input mask 00/00/000. I want to query all the
people under age 17 as of the current date. Really not sure what criteria to
use for this. Any ideas? Thanks.
 
R

Rick B

You'd need to add a column to calcualte age and then put the criteria of
"<17" under it. Tocalculate age, add a new column to your query as follows.
Replace [Birthdate] with the name of your field....


PersonAge:
DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(
),"mmdd"))
 
A

Allen Browne

The people under 17 were born in the last 17 years, so use criteria under
your BirthDate field of:
 
R

Rick B

What about someone born last month? They just turned 17, but they will
still show up.
 
D

Duane Hookom

Rick,

Try it.
Allen's expression if run today will return 3/14/1988. This seems fairly
reasonable to me.
 
D

Duane Hookom

I thought I could question one of Allen's responses once, but after testing,
I found I was wrong ;-)
 

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