cervantes008
Registered User.
- Local time
- Yesterday, 22:49
- Joined
- Jul 21, 2006
- Messages
- 14
Is there a way to have this stopwatch to countdown from 10 minutes to 00:00:00:00?
Code:
Option Compare Database
Option Explicit
Dim TotalElapsedMilliSec As Long
Dim StartTickCount As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Form_Timer()
Dim Hours As String
Dim Minutes As String
Dim Seconds As String
Dim MilliSec As String
Dim Msg As String
Dim ElapsedMilliSec As Long
ElapsedMilliSec = (GetTickCount() - StartTickCount) + _
TotalElapsedMilliSec
Hours = Format((ElapsedMilliSec \ 3600000), "00")
Minutes = Format((ElapsedMilliSec \ 60000) Mod 60, "00")
Seconds = Format((ElapsedMilliSec \ 1000) Mod 60, "00")
MilliSec = Format((ElapsedMilliSec Mod 1000) \ 10, "00")
Me!ElapsedTime = Hours & ":" & Minutes & ":" & Seconds & ":" _
& MilliSec
End Sub
Private Sub btnStartStop_Click()
If Me.TimerInterval = 0 Then
StartTickCount = GetTickCount()
Me.TimerInterval = 15
Me!btnStartStop.Caption = "Stop"
Me!btnReset.Enabled = False
Else
TotalElapsedMilliSec = TotalElapsedMilliSec + _
(GetTickCount() - StartTickCount)
Me.TimerInterval = 0
Me!btnStartStop.Caption = "Start"
Me!btnReset.Enabled = True
End If
End Sub
Private Sub btnReset_Click()
TotalElapsedMilliSec = 0
Me!ElapsedTime = "00:00:00:00"
End Sub