View Full Version : Calculating age over 100 years


StephenB
05-14-2002, 08:31 AM
I have the following on a form:

Private Sub DOB_Exit(Cancel As Integer)
[Age] = ((Date) - [DOB])
End Sub

DOB (date of birht) is a field on a table. Age is an unbound field. This correctly returns the age when I enter a DOB that should return 99 years old or less. But when I enter a DOB that should return 100 years old or more, the age resets to zero.

Any suggestions on how I can correct this?

Pat Hartman
05-14-2002, 11:21 AM
Assuming that DOB is a date/time field, the calculation as shown correctly returns the age in days. Is that what you want? If not, use the DateDiff() function or divide by 365 to get the age in years. Search this site or the Microsoft knowledge base for more DOB calculations.

StephenB
05-15-2002, 04:01 AM
Thank you Pat.

StephenB
05-15-2002, 07:33 AM
Thanks, Pat, (Again).

I had tried **many** of the recommendations that they suggested. Nothing was working. Turns out I had a format on the age field. Duh.

Glad your here.

Stephen