QUERY DESIGN

C

cougarmom

I am using Access 2003. How do I design a query to obtain clients age? I
have a column in my table for DOB. The data is entered in mm/dd/yyyy format.
The data type in design view is Date/Time, and the Format is Short Date. I
am needing to find all clients in my table that are <40, 40-49, 50-64, & >65.
 
J

John Spencer

Here are two expressions that should calculate the age of a person in whole
years as of the current date

'Fails if DOB is null, Error generated
Int(Format(Date(), "yyyy.mmdd") - Format([DOB], "yyyy.mmdd"))

'Returns Null if DOB is Null
DateDiff("yyyy",DOB,Date()) + Int(Format(DOB,"mmdd") >
Format(Date(),"mmdd"))


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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