Quote:

> have a database with two of the fields being date/time data type. the

> vb (16bit) form that displays the info from the table needs to show

> timeA and timeB in two separate text boxes. no problem there. but must

> have a third text box displaying timeC as the difference between times

> A and B. tried datediff and serial time with no luck. any suggestions

> for this newbie would be greatly appreciated. tks in advance.

TimeC = DateDiff("n",TimeA,TimeB)

should return the difference between the two times in minutes. You

could then use the MOD function to parse out days, hours, and remainder

minutes to display Time3 as you wish. Check out the on-line Help in VB

for the DateDiff interval argument constants, if your concern is with

hours, days, months....

Alternatively, you could create a small user defined function in your

backend to do this. If your db is Access and your db resides on a

faster box, then try this one:

Function GetTimeElapsed (interval)

Dim ttlHours As Long

Dim ttlMins As Long

Dim ttlSecs As Long

Dim Days As Long

Dim Hours As Long

Dim Mins As Long

Dim Secs As Long

Days = Int(CSng(interval))

ttlHours = Int(CSng(interval * 24))

ttlMins = Int(CSng(interval * 1440))

ttlSecs = Int(CSng(interval * 86400))

Hours = ttlHours Mod 24

Hours = Hours + (Days * 24)

Mins = ttlMins Mod 60

Secs = ttlSecs Mod 60

' the returned value is:

GetTimeElapsed = Hours & ":" & Format(Mins, "00")

End Function

Good luck, Dan

--

****************************************************************

* w) 212-735-3000 x5645 cis: 76116,3227 *

* h) 212-864-7273 *

* f) 212-735-2001 *

****************************************************************