Age Calculation - Error

D

Dave K

I am using the below formula on a DOB column in an update query. Am
getting large numbers (e.g., "11979" for the date of birth 1/16/1977)
as the results, rather than the member age I am intending to get. Does
anyone know what may be the problem?

DateDiff("y",[Birthdate],Now())
 
D

Douglas J. Steele

The first error is that you need "yyyy", not "y". "yyyy" gives the
difference in years, "y" gives it in days.

However, changing to "yyyy" won't be completely accurate, given how DateDiff
works (it counts the number of transitions encountered, so 31 Dec, 2009 to 1
Jan, 2010 is counted as one year, since the year has changed...)

For a more correct approach, see
http://www.mvps.org/access/datetime/date0001.htm at "The Access Web"
 

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