calculating age at a particular 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
 
F

fredg

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top