calculate age in query

G

Grams

In that order - years, months, day
=DateDiff("mmddyyyy",[BirthDate],Now())+(Format([BirthDate],"mmddyyyy")>Format(Now(),"mmddyyyy"))
I got the above from a post but when I try it I get #Error

Help
Janet
 
D

Douglas J. Steele

DateDiff will not accept mmddyyyy as a parameter. As well, you don't want to
include yyyy in the Format statements: all you're trying to do is determine
whether or not the birthday has occurred yet this year:

=DateDiff("yyyy",[BirthDate],Now())+(Format([BirthDate],"mmdd")>Format(Now(),"mmdd"))
 
D

Douglas J. Steele

Sorry, just noticed that in another newsgroup you'd posted using a different
subject (that you wanted the age in years, months and days). See
http://www.accessmvp.com/DJSteele/Diff2Dates.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Douglas J. Steele said:
DateDiff will not accept mmddyyyy as a parameter. As well, you don't want
to include yyyy in the Format statements: all you're trying to do is
determine whether or not the birthday has occurred yet this year:

=DateDiff("yyyy",[BirthDate],Now())+(Format([BirthDate],"mmdd")>Format(Now(),"mmdd"))


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Grams said:
In that order - years, months, days
=DateDiff("mmddyyyy",[BirthDate],Now())+(Format([BirthDate],"mmddyyyy")>Format(Now(),"mmddyyyy"))
I got the above from a post but when I try it I get #Error

Help
Janet
 

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