dates of birth and ages fields

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

Guest

I have a database whith family records on, when our date of births are put in
the ages are automatically added and changes as the the year changes. when a
quary is done some of the ages are not showing or arew wrong, this also is
happening when I view the form in the tables view.
 
I have a database whith family records on, when our date of births are put in
the ages are automatically added and changes as the the year changes. when a
quary is done some of the ages are not showing or arew wrong, this also is
happening when I view the form in the tables view.

1) All you should save in your table is the date of birth, not the
age. Any age saved in your table is going to be wrong within a year.

2) When you need that person's age, calculate it, in a query, form, or
report.

3) Here is an expression you can use to accurately calculate a persons
age. It takes into effect whether or not that month and day has
already passed.

Age: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:
=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),
"mmdd"),1,0)
 
Back
Top