how to compose a query expression, so that the person's age is ad.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how to compose a query expression, so that the person's age is adjusted on
their birthday each year? That is, they turn 18, 19, 20... on their birthday.
I am looking for some simple expresion.
 
how to compose a query expression, so that the person's age is adjusted on
their birthday each year? That is, they turn 18, 19, 20... on their birthday.
I am looking for some simple expresion.

You don't!
Whenever you need a persons age, you compute it - at that time - from
the [DateOfBirth] field that is stored in your table. This way there
is no need to adjust the age at all.

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 report or
on a form:

=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),
"mmdd"),1,0)
 
Back
Top