On Thu, 23 Oct 2008 11:12:01 -0700, Learner's Permit DB wrote:
> 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.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|