From my file (see below my Sig) ------
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
Countdown Timer On A Form
Q I would like to have a form that once opened would start to countdown for
lets say 30 seconds. Once it reaches 0, some event will occur. I would like
the numbers to change every second so that the user knows how long before
the event occurs. Any ideas on how to do this.
A Add the following code to the form:
Put this statement in the Options Explicit header:
Dim mintTimer As Integer
Private Sub Form_Load()
mintTimer = 30 ' 30 seconds
txtShowTimer.Value = mintTimerStart ' show the time in a textbox
TimerInterval = 1000 ' 1 second
End Sub
Private Sub Timer()
mintTimer = mintTimer - 1 ' count down
txtShowTimer.Value = mintTimerStart ' show the time in a textbox
If mintTimer = 0 Then
'do your event.
TimerInterval = 0 ' Stop the timer
End If
End Sub