countdown timer

R

Robert G

I would like to create a form that has at least 5 timers on it to count down
the time from when a start button is pressed, counting down from 60, 10, 5,
3, and 2 minutes. There needs to be a reset button, with the times reset for
each. What would be the code for this?
 
J

John W. Vinson

On Sat, 24 Apr 2010 12:51:01 -0700, Robert G <Robert
I would like to create a form that has at least 5 timers on it to count down
the time from when a start button is pressed, counting down from 60, 10, 5,
3, and 2 minutes. There needs to be a reset button, with the times reset for
each. What would be the code for this?

Well, you'ld use the form's Timer property to count down by seconds or minutes
as you prefer, updating five textboxes. It's not clear whether these are all
independent, or each have their own start and stop buttons, or how you want
the timer to look. More details please!
 
A

Afrosheen via AccessMonster.com

Don't know if this will work, but I set up a timer that counts down the
number of seconds. Maybe you can modify the code. This code allows the usage
of the program time.

140 Const BEGIN_TIME = #4:30:00 AM#
150 Const END_TIME = #8:45:00 PM#

160 If Time < BEGIN_TIME Or Time > END_TIME Then
170 DoCmd.OpenForm "frmTimer"
180 End If


Then I created a form with this code:

'-----------------------------------------------------------------------------
----------
' Procedure : Form_Open
'-----------------------------------------------------------------------------
----------
'
Private Sub Form_Open(Cancel As Integer)
10 Me.txtTimer.Value = 30
End Sub


'-----------------------------------------------------------------------------
----------
' Procedure : Form_Timer
'-----------------------------------------------------------------------------
----------
'
Private Sub Form_Timer()

10 Me.txtTimer.Value = Me.txtTimer.Value - 1

20 If Me.txtTimer.Value = 0 Then
30 DoCmd.Quit
40 Else

50 End If
End Sub


The txtTimer is an unbound text box set at 30 seconds

I hope this helps.
 
A

Arvin Meyer [MVP]

Here's the reverse of what you want. It's a stopwatch. The relevant code can
easily be reversed to count down instead of up:

http://www.datastrat.com/Download/StopWatch2K.zip

Since it probably wouldn't make sense to have all 5 timers counting at once,
you could use and option group, combo box, or list box to feed the time. If
you did want all five at once, you should open a form with a message at each
milepost in your timeline.

Access does not have Timer controls, but it does have the Timer property and
event in a single form, so you can also use 5 forms.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top