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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateDIff

Status
Not open for further replies.

hawg9

IS-IT--Management
Nov 9, 2005
22
US
I am trying to find the difference between Todays date and another field called Went Negative Date. I have the following code in place but I am receiving an error. Please help me locate the error in my code.

=DateDiff("d",[WentNegative],Now())
 
What is the meaning of the equal sign ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
it doesn't have a meaning. It is not in the actual formula. However, in the process of working on this issue, I have uncovered another one. The Went Negative field was imported as a text field instead of a Date / Time field. So, I am in need of a way to convert this field to a Date / Time field and then run the DateDiff query.
 
Like this ?
Int(Now()-CDate([WentNegative]))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried that and I am still getting a #Error. Went Negative is in the DB as a text field (ie. "20051231"). Any other suggestions?
 
Int(Now()-DateSerial(Left([WentNegative],4),Mid([WentNegative],5,2),Right([WentNegative],2)))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Worked like a champ. Thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top