Full Version: Date Question.
UtterAccess Forums > Microsoft® Access > Access Forms
sredworb
Hello
Trying to figure this out
DateOfBirth til DateOfDeath = Aged
=DateDiff("yyyy",[DateOfBirth],Now())+Int(Format(Now(),"mmdd")<Format([DateOfBirth],"mmdd"))
Using this for living age, trying to figure out what to squeeze in there to get this to work and stop counting years.
Any help is greatly appreciated..
Jerry
GroverParkGeorge
This age calculation code is inthe archives.
On order to make this flexible for both start date (e.g., any DOB) and end date (e.g., Date of Death), I would wrap this in a function.
Public Function fAgeAtDate(dtStartDate As Date, dtAtDate As Date) As Integer
fAgeAtDate = DateDiff("yyyy", dtStartDate, dtAtDate) + (DateSerial(Year(dtAtDate), Month(dtStartDate), Day(dtStartDate)) >= dtAtDate)
End Function
sredworb
Thanks George,
Ok, thanks again
Jerry
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.