Age is coming up wrong

D

Debbie

This is an unbound in a form

I noticed that this part of the formula is not calculating correct.
For example [DOB] is 2/27/07 and the answer comes back 8 months. The
child is 7 months until Octboer 27th. Does anyone know what I did
wrong in this formula.
This is the part that is wrong: IIf(DateDiff("m",
[DOB],Date())<24,DateDiff("m",[DOB],Date()) & " Months",

This is the actual formula:
=IIf(DateDiff("d",[DOB],Date())<60,DateDiff("ww",[DOB],Date()) & "
Weeks",IIf(DateDiff("m",[DOB],Date())<24,DateDiff("m",[DOB],Date()) &
" Months",Int(DateDiff("m",[DOB],Date())/12) & " Years"))
 
B

Beetle

The DateDiff function doesn't work very well for age (at least not without
some modification). For example, in your case you are asking for the
difference in months. Since October is the 10th month and February is the 2nd
month, it will always show 8 when you are using it as you are. You will find
a better DateDiff function at the following link;

http://www.accessmvp.com/djsteele/Diff2Dates.html

It was written by Douglas J Steele and Graham Search (a couple of guys that
are alot smarter than I am)

HTH
 

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