Calculating Age

L

Lakebum

I am just learning Access!! I have found the expression to use to calculate
the age using the birthdate field, but where do I put that expression. I
would like to see it on my form> Please help
 
F

fredg

I am just learning Access!! I have found the expression to use to calculate
the age using the birthdate field, but where do I put that expression. I
would like to see it on my form> Please help

In a query:

In a query, add a new column:
Age: DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],
"mmdd")>Format(Date(),"mmdd"),1,0)

Directly as the control source of an unbound control on a form or
report:
=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],
"mmdd")>Format(Date(),"mmdd"),1,0)

Where [DOB] is the birthdate field.

You do know, I hope, that this Age computation should NOT be stored
in any table. Just compute it and display it on a query or form or
report, as needed.
 

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