DateDiff

moleary

Senior Member
Local time
Today, 21:25
Joined
Feb 9, 2001
Messages
58
I am trying to do a datediff for a query to get a age for our clients, but it is not giving me their age it is giving me a long number?? I am using datediff "y",date of birth, date(),) but it gives me something like 24975?? Does it have something to do with the century change?
 
Try this. Age: DateDiff("yyyy",[date of birth],Now())
You need to add 3 more y's
 
This question has been covered a few times in the last week or so.

I think you will find that your method will not return the correct age. If the DOB is 1/1/54 the expression will return 47 (this is correct), but if the DOB is 12/1/54 it will again return 47 (should be 46), the birthday has not occured yet.

Use the following instead. It will always return the correct age based on the current date.

Age: DateDiff("yyyy",[date of birth],Date())+(Date()<DateSerial(Year(Date()),Month([date of birth]),Day([date of birth])))
(all of the above should be one line)

HTH
RDH

[This message has been edited by R. Hicks (edited 10-25-2001).]
 

Users who are viewing this thread

Back
Top Bottom