[AccessD] Date Diff Help It cant be this hard

Joe Hecht jmhecht at earthlink.net
Sun Jan 8 22:39:00 CST 2006


Why cant I get the proper age to return.

 

This code errors at run time. Dateborn = me.dob  has no
value.

 

 

 

Private Sub Report_Open(Cancel As Integer)

Dim datenow As Date

Dim dateborn As Date

Dim txtage As Integer

 

 

    datenow = Now()

    dateborn = Me.DOB

    

Me.txtage = DateDiff("yyyy", datenow, dateborn)

End Sub

 

Either in txtage or somewhere I want to get the persons
current age stuffed into txtAge.

 

Thanks 

Joe Hecht

jmhecht at earthlink.net

  _____  

From: Joe Hecht [mailto:jmhecht at earthlink.net] 
Sent: Friday, January 06, 2006 8:52 PM
To: 'Access Developers discussion and problem solving'
Subject: Date Diff Help

 

I am trying to do a an age calculation with the following
data source.

 

=DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd"))

 

DOB is the employees date of birth.

 

If Dob is 5/11/1940 I am expecting to get 65 back not 172.

 

TIA

 

Joe Hecht

jmhecht at earthlink.net

 




More information about the AccessD mailing list