Timer for form

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

I want a timer to count down on my form from lets say 30 seconds to zero.
I want it to show each second that it counts down to. i.e. 30, 29, 28,
etc...until it reaches zero and then stop.
Where can I find such a thing or else how can I do it?

I need a label or something to do this!
 
Dave Elliott said:
I want a timer to count down on my form from lets say 30 seconds to zero.
I want it to show each second that it counts down to. i.e. 30, 29, 28,
etc...until it reaches zero and then stop.
Where can I find such a thing or else how can I do it?

I need a label or something to do this!

Something like this in the Timer event:

Private Sub Form_Timer()
'NOTE: The Timer Interval = 1000 (1 second)

Me!lblCounter.Caption = Me!lblCounter.Caption - 1

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Ok, this works counting back from 30 to zero
Next I want it to stop at zero.

Me!lblcounter.Value = Me!lblcounter.Value - 1
 
So add code to make it look like this:

Private Sub Form_Timer()
'NOTE: The Timer Interval = 1000 (1 second)

Me!lblCounter.Caption = Me!lblCounter.Caption - 1

If Me!lblCounter.Caption = 0 Then
Me.TimerInterval = 0
End If

End Sub
 
Back
Top