G
Guest
I need help on the formula given to change control source for calculating age
from date of birth on forms in access
from date of birth on forms in access
I need help on the formula given to change control source for calculating age
from date of birth on forms in access
Hi Kaz,
This should calculate the age based on birthday to present.
DateDiff("yyyy",#DateOfBirth#,Now())
John Vinson said:Hi Kaz,
This should calculate the age based on birthday to present.
DateDiff("yyyy",#DateOfBirth#,Now())
Actually this will calculate the number of January 1sts that have
passed between the date of birth and now, and because of the invalid #
syntax it won't work anyway!
Try it: if the field DateOfBirth contains #12/25/2003# and you run the
query on January 6, it will say that the 12-day old baby is one year
old.
Instead, use
DateDiff("yyyy", [DateOfBirth], Date()) - IIF(Format([DateOfBirth],
"mmdd") > Format(Date(), "mmdd"), 1, 0)
to subtract a year if the birthday anniversary has not yet arrived.
John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps