MS Access age less than 18 years

I have a  date of birth field that is a string YYYYMMDD.  We want persons that are 18 years old or younger as of today's date.  What syntax would I use in an Access query for a report?
LindaOKSTATEAsked:
Who is Participating?
 
Patrick MatthewsCommented:
SELECT *
FROM SomeTable
WHERE DOB >= Format(DateAdd("yyyy", -18, Date()), "yyyymmdd")
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Ahh ... what happens if the DOB is tomorrow 20111011 ?

0
 
Patrick MatthewsCommented:
You're projecting future births?

:)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
sorry ... I meant say:

To be 18 Today, DOB would be 10-10-1993

What about Tomorrow thru 12-31-2011 ?

I think your age calc shows still shows 18, which is incorrect.

mx
0
 
LindaOKSTATEAuthor Commented:
Not sure what you mean?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Well ... age calcs are tricky ... is what I'm saying.

mx
0
 
LindaOKSTATEAuthor Commented:
I guess that person would not show up until the next report.  What else could you do?
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Patrick ... ignore my comments.  I still have stated it correct.  The age stuff fries my brain every time.

mx
0
 
Gustav BrockCIOCommented:
I cannot see how it should fail. DateAdd is always right.

/gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.