Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateDiff question

Status
Not open for further replies.

SidCharming

Technical User
Jun 18, 2003
73
US
I want to calculate the age of a patient based on their date of procedure (DOP) and date of birth (DOB). I used the command:

Format((DateDiff("d",[DOB],[DOP]))/365,"Fixed")

This is fine for giving me a value, but the value is not a numerical value and I can not perform my statistics against it. I am possitive I am overlooking something that converts it to numerical value so I can (sum, min, max, StDev) the values.



Sid from Minnesota
 
Sid,

Wrap your Format with a CInt function.

CInt(Format((DateDiff("d",[DOB],[DOP]))/365,"Fixed"))

This will convert the formatted expression to a numeric value.


HTH,


Steve
 
That works, but what about getting decimal places to either tenths or hundreths? I tried looking up Cint with Access 2002 help with NO luck finding anything on it. Can i convert to single or double?

Sorry to be inconvenience, but I am not finding the MS Access any help at at all!



Sid from Minnesota
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top