-
does anybody know a way to calculate the age of a record.
I am writing a call logging system, and as each call is recieved a field in the calls table is used to store the date and time ( using the vb NOW function )
What the system does at a later point is queries the database and gets all outstanding calls.
I then grab the oldest call, and I need to be able to say how old the call is in DAYS, HOURS and Minutes.
But I am not sure how to do this, is there a vb funstion to carry out the calculation?
IE:
Outstanding = NOW - OLDDATE
ANY IDEAS!!!
-
<?>
'will give you the days
'my var = your mdb field
myVar = "9/01/2000 7:40:08 AM"
MsgBox "Days from today: " & DateDiff("d", myVar, Now)
-
<?>
Code:
Private Sub Form_Load()
Dim myvar As Date
'my var = your mdb field
myvar = "9/01/2000 7:40:08 AM"
Dim mHour As Double, mMin As Double, mSec As Double
mHour = DateDiff("h", myvar, Now)
mMin = DateDiff("m", myvar, Now)
mSec = DateDiff("s", myvar, Now)
Dim myTimeGone As String
myTimeGone = " Hours = " & mHour & ":" & " Minuites = " & mMin & ":" & " Seconds = " & mSec
MsgBox myTimeGone
End Sub