Negative time calculations

J-F

Registered User.
Local time
Today, 05:56
Joined
Nov 14, 2001
Messages
41
I have 2 times (hh:mm:ss) where I need to show the difference between the 2 but show a negative value should the second time be larger than the first.

I have tried the following which works but doesn't give a negative result.

FormatDateTime(((oRSMyResults.Fields.Item("TotalTrans").Value) - (oRSHisResults.Fields.Item("TotalTrans").Value)),vbLongTime)

Any ideas please???
 
Try:
iif(oRSMyResults.Fields.Item("TotalTrans").Value) > oRSMyResults.Fields.Item("TotalTrans").Value) , FormatDateTime(((oRSMyResults.Fields.Item("TotalTrans").Value) - (oRSHisResults.Fields.Item("TotalTrans").Value)),vbLongTime), - FormatDateTime(((oRSMyResults.Fields.Item("TotalTrans").Value) - (oRSHisResults.Fields.Item("TotalTrans").Value)),vbLongTime))

To be more clear:
iff(Time1>Time2, FormatDateTime(Time1-Time2, vbLongTime), -FormatDateTime(Time1-Time2,vbLongTime))


Alex

[This message has been edited by Alexandre (edited 02-10-2002).]
 

Users who are viewing this thread

Back
Top Bottom