patriciaxxx
Programmer
I have a VBA UserForm in my Access 2003 database which displays the time elapsed. currently i have only coded it for hh mm ss (hours minutes seconds)
I need the label to display the time as it elapses in the format 00:00:00:00
(hours minutes seconds and fractions of seconds ie 100ths of seconds or milliseconds)
This is my code so far:
I need the label to display the time as it elapses in the format 00:00:00:00
(hours minutes seconds and fractions of seconds ie 100ths of seconds or milliseconds)
This is my code so far:
Code:
rivate Sub UpdateTimerLabel()
Dim ss As Long
Dim mm As Long
Dim hh As Long
Dim sglTimer As Single
Const WAV_FILE As String = "C:\WINDOWS\MEDIA\tada.WAV"
sglTimer = Timer
Do
ss = Int(Timer - sglTimer)
If ss = 60 Then mm = mm + 1: ss = 0: sglTimer = Timer
If mm = 60 Then hh = hh + 1: mm = 0: sglTimer = Timer
lblTimer.Caption = Format(hh, "00") & " Hrs : " & Format(mm, "00") & " mins : " & Format(ss, "00") & " Secs"
DoEvents
Loop Until bExit Or bScore Or bAbort
If bScore Then
PlaySoundAPI WAV_FILE, ByVal 0&, SND_FILENAME Or SND_LOOP Or SND_ASYNC
If MsgBox("Congratulations " & sUserName & " !!" & vbCrLf & vbCrLf & _
"You scored in : " & Format(hh, "00") & " Hrs : " & Format(mm, "00") & " mins : " & Format(ss, "00") & " Secs" & vbCrLf & _
"Do you want to save this score to your scores history ?", vbQuestion + vbYesNo) = vbYes Then
Call SaveTheScore(hh, mm, ss)
End If
PlaySoundAPI WAV_FILE, ByVal 0&, SND_FILENAME Or SND_PURGE
End If
lblTimer.Caption = ""
Call EnableControls(True)
Call DeletePreviousImages
Set frameSourcePic.Picture = oPic
End Sub