'---------------------------------------------------------------------------------------
' Procedure : testTimer
' Author : Jack (from access group discussions)
' Created : 11/28/2010
' Purpose : To show the use of clsTimer
'With a class you can instantiate 1 or a thousand of these timers and
'EACH INSTANCE has its own timer storage variable safely encapsulated in its own class header.
'
'Dim lclsTimer0 As clsTimer
'Dim lclsTimer1 As clsTimer
'Dim lclsTimer2 As clsTimer
'.
'.
'.
'Dim lclsTimer999 As clsTimer
'There you go, 1,000 DIFFERENT timers all happily timing their own pieces
'of your code, measuring various forms opening, reports opening,
'while loops whiling.
'
'The tick count is in fact 1 millisecond, and USUALLY you will get results to 1 millisecond.
'
'Whatever the count, it is certainly relative and can show relative times.
'
'More time stuff at http://www.devx.com/dbzone/Article/39046
'
'---------------------------------------------------------------------------------------
' Last Modified:
'
' Inputs: N/A
' Dependency: N/A
'------------------------------------------------------------------------------
'
Sub testTimer()
On Error GoTo testTimer_Error
Set lclsTimer0 = New clsTimer
Set lclsTimer1 = New clsTimer
Set lclsTimer2 = New clsTimer
Dim myVar As Long
While myVar < 100000000
If myVar = 75000000 Then
Debug.Print "Timer0 " & lclsTimer0.EndTimer & " MyVar reached " & myVar
End If
If myVar = 10000000 Then
Debug.Print "Timer1 " & lclsTimer1.EndTimer & " MyVar reached " & myVar
End If
myVar = myVar + 1
Wend
Set lclsTimer3 = New clsTimer 'start Timer3
Debug.Print "Timer2 " & lclsTimer2.EndTimer & " MyVar reached " & myVar
Debug.Print "Timer3 Processing this last debug took " & lclsTimer3.EndTimer & " tick(s)" 'Stop Timer3
On Error GoTo 0
Exit Sub
testTimer_Error:
MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure testTimer of Module Module1"
End Sub