date

message from =?Utf-8?B?am9z?= on 14 May 2004
how to tell access what age somebody has. by using birthdate and systemdate?
 
Douglas J. Steele replied to =?Utf-8?B?am9z?= on 14 May 2004
DateDiff("yyyy", [Birthdate], Date()) - _
IIf(Format(Date(), "mmdd") < Format([Birthdate], "mmdd"), 1, 0)

The first part gives the difference in years between the 2 dates.
Unfortunately, the DateDiff function is a little too literal: it sees
2003/12/31 and 2004/01/01 as being one year apart, so it's necessary to add
the second part, which checks to see whether the birthday has already
occurred this year. If it has not, you subtract 1 from the value computed by
DateDiff.
 
Pieter Wijnen replied to =?Utf-8?B?am9z?= on 14 May 2004
Check the DateDiff Function
HTH

Pieter

"jos" <jlm leufkens@home.nl> wrote in message
news:8167DE97-31E8-4E82-A5B4-FCA443184C71@microsoft.com...
 
Van T. Dinh replied to =?Utf-8?B?am9z?= on 14 May 2004
http://www.mvps.org/access/datetime/date0001.htm
 

Archived message: date (Microsoft Access)