age calculation

  • Thread starter Thread starter Learner's Permit DB
  • Start date Start date
L

Learner's Permit DB

I'm a bit new to programming in Access DB. I would like to calculate the age
of a person within a table. Is this possible? How would I go about doing
this?
 
I'm a bit new to programming in Access DB. I would like to calculate the age
of a person within a table. Is this possible? How would I go about doing
this?

"Within a table"?
You mean do the computation in a table? No, you can't.
However ....
In a query:
Age: DateDiff("yyyy",[DOB],Date())-Iif(Format([DOB],
"mmdd")>Format(Date(),"mmdd"),1,0)

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

Where [DOB] is the birthdate field.

This Age computation should NOT be stored in any table. Just compute
it and display it on a form or report, as needed.
 
Back
Top