Calculating age from current date-DOB

G

Guest

I'm trying to display someones age using (date ()-DOB)/365 but I get years
with a decimal ( ie 76.7 years). If I change the format to "fixed" and set
the decimal places to "0" then it rounds up the age ( ie 77 years) How can I
display just 76 which is the more conventional way we talk about age.
 
R

ruralguy via AccessMonster.com

Maybe this will help.

Public Function Age(DOB As Date) As Integer

Age = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB),
Day(DOB)))

End Function
 

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