Countdown Timer for Access Practice Exam Database

CMSUser

New member
Local time
Today, 04:18
Joined
Jun 7, 2015
Messages
3
Hi,

I would like to create a countdown timer for a practice exam database that I am creating. The practice exam lasts up to 4.5 hours. I found this code from YouTube and it was created by someone as a 10 second timer. He created a command button called "btn_Timer." When you click the button, 10 seconds is displayed in the textbox, "txt.Time." This code works perfectly if I only want the timer to display in seconds. However, how can I use this code to create a timer that formats the time as HH:mm:ss (i.e., in hours, minutes, and seconds)? The code is below. Thanks!

Option Compare Database

Dim m_intTimer As Integer

Private Sub btnTimer_Click()
Me.TimerInterval = 1000
m_intTimer = 10 ' 10 seconds
Me.txtTime.SetFocus
Me.txtTime.Text = m_intTimer
Me.btnTimer.SetFocus
End Sub

Private Sub Form_Timer()

m_intTimer = m_intTimer - 1 ' count down
Me.txtTime.Value = m_intTimer 'show the time in a textbox
If m_intTimer = 0 Then
' do your event.
TimerInterval = 0 'Stop the timer
MsgBox "Time is up"

End If

End Sub
 
Take a look at Form1 in the attached db. Note its use of code in Module1. This is NOT my code and I take NO credit for it. I found it in a google search.
Hope this helps.
 

Attachments

So, CMSUser,

Did you find the db attached in my last post of any help to you?
 
Sorry, I have been having computer troubles. Thank you so much for your reply, bob fitz! I will take a look at it now.
 
bob fitz, this is exactly what I needed. Thanks so much for the find!!!!
 

Users who are viewing this thread

Back
Top Bottom