[AccessD] Elapsed time class - Stuart please ignore...

jwcolby jwcolby at colbyconsulting.com
Sat Jul 16 10:01:25 CDT 2011


Set the form's TimerInterval to 0.

The class with a pad function for the display and changing longs to int.

Option Compare Database
Option Explicit

Private mintSeconds As Integer
Private mintMinutes As Integer
Private mintHours As Integer
Private mstrElapsedTime

Property Get pElapsedTime() As String
     pElapsedTime = mstrElapsedTime
End Property
Property Get pSeconds() As Integer
     pSeconds = mintSeconds
End Property
Property Get pMinutes() As Integer
     pMinutes = mintMinutes
End Property
Property Get pHours() As Integer
     pHours = mintHours
End Property
Function mPad(intToPad As Integer) As String
Dim strToPad
     strToPad = intToPad
     If Len(strToPad < 2) Then
         strToPad = "0" & strToPad
     End If
     mPad = strToPad
End Function
Private Function CalcElapsedTime()
Dim strPad As String
     mstrElapsedTime = mPad(mintHours) & ":" & mPad(mintMinutes) & ":" & mPad(mintSeconds)
End Function
Function mResetElapsedTime()
     mintSeconds = 0
     mintMinutes = 0
     mintHours = 0
End Function
Function UpdateElapsedTime()
     mintSeconds = mintSeconds + 1
     If mintSeconds >= 60 Then
         mintSeconds = 0
         mintMinutes = mintMinutes + 1
     End If
     If mintMinutes >= 60 Then
         mintMinutes = 0
         mintHours = mintHours + 1
     End If
     CalcElapsedTime
End Function

John W. Colby
www.ColbyConsulting.com

On 7/16/2011 10:48 AM, Arthur Fuller wrote:
> Nice and clean. How do you stop the timer?
>
> A.



More information about the AccessD mailing list