Forum Discussion
Jqws13_
Apr 14, 2022Copper Contributor
Calculating Age In Access
Hi All, Just got a question regarding calculating ages in tables in access. I am on Access 2016, and I have two columns, DOB, and Death Date. I only have one entry for a death date, and if there is...
isladogs
Apr 16, 2022MVP
AFAIK, the simplest expression for calculating age in years to the current date is:
Function AgeYears(DOB As Date) As Integer
AgeYears = DateDiff("yyyy", DOB, Date) + (Format(DOB, "mmdd") > Format(Date, "mmdd"))
End Function
It could easily be adapted to allow for date at death as above
George_Hepworth
Apr 16, 2022Silver Contributor
You could even modify it to return either "age at death" or "current age", using a Iif() or Switch()....
- isladogsApr 16, 2022MVP
You could indeed ...
- isladogsApr 19, 2022MVP
For info, I've added a new page to my website Calculate Age (isladogs.co.uk).
It includes various functions to calculate age in years, years and months or years, months and days.
Calculations can be done to the current date or between two specified dates