Help with an expression

  • Thread starter Thread starter Gary M Hull
  • Start date Start date
G

Gary M Hull

Hey all

Hope this is the right group!

I am working on a contest database

It is for Tractor Pulls

This involves coming up with the correct age of the child the day of the
Tractor Pull

Say the DOB of the child is 12/07/1995

And the day of the pull is 12/07/2003

That would make the child 8Yrs on the day of the pull 12/07/2003

If the Pull were held on 12/06/2003 then the child would be 7Yrs old

Test: (DateDiff("yyyy",[DOB],[LocalDate])

If I use the above formula, it does not work

If I the DOB is 12/07/1995, and the day of the pull is 12/06/2003. The
formula, Test: (DateDiff("yyyy",[DOB],[LocalDate]) says the child is
8Yrs old when in fact the child is still 7Yrs old

I need help with a Formula that will give the Childs correct age on the
day of the pull.

Thanks all
 
Hello Gary,
I looked at the DateDiff function a bit, and it always
seems to be one year ahead. This is what I came up with:

MsgBox DateDiff("yyyy", #5/13/1985#, Date) - 1
(note that Date gives today's date)

So, I guess just try this:
(DateDiff("yyyy",[DOB],[LocalDate]) - 1

Basically the same, just subtract one. All I can say is
test this. If it works, and the values are correct- keep
it.

Good luck,
Andy
 
Back
Top