Calculating Age

G

Guest

Hi,

I'm trying to write a query that will pull the age of a person. If they were
born in March 2000 there age would be 4 but if they were born in January 2000
there age would be 5.
I need to include the month to give an accurate calculation

Thanks
 
T

Tom Lake

Todd said:
Hi,

I'm trying to write a query that will pull the age of a person. If they
were
born in March 2000 there age would be 4 but if they were born in January
2000
there age would be 5.
I need to include the month to give an accurate calculation

The following will do it for you (No credit to me, this has been floating
around for years):

Age = DateDiff("yyyy", [DateOfBirth], Date()) - IIf(Format$(Date(), "mmdd")
< Format$([DateOfBirth], "mmd­d"), 1, 0)

Tom Lake
 

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