calculating age at a particular date

  • Thread starter Thread starter Jennifer K.
  • Start date Start date
J

Jennifer K.

Two questions really:

I would like to calculate the age of someone when a specific event takes
place. Example: I have Date of Birth and Date of Marriage and I want to
calculate the age in years between those two events. The information will be
entered using a form.

Additionally, and likely very less advisedly, they would like this number
calculated and then want it to populate a field in a table.

Once again I greatly appreciate any advice provided.

Jennifer
 
Two questions really:

I would like to calculate the age of someone when a specific event takes
place. Example: I have Date of Birth and Date of Marriage and I want to
calculate the age in years between those two events. The information will be
entered using a form.

Additionally, and likely very less advisedly, they would like this number
calculated and then want it to populate a field in a table.

Once again I greatly appreciate any advice provided.

Jennifer

To calculate someone's age at the time of their marriage:

In a query:
Age: DateDiff("yyyy",[DOB],[DateOfMarriage])-Iif(Format([DOB],
"mmdd")>Format([DateOfMarriage],"mmdd"),1,0)

Directly as the control source of an unbound control:
=DateDiff("yyyy",[DOB],[DateOfMarriage])-IIf(Format([DOB],
"mmdd")>Format([DateOfMarriage],"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, when needed.
 
Back
Top