Calculating Age

  • Thread starter Thread starter Lakebum
  • Start date Start date
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
 
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.
 
Back
Top