Countdown timer

  • Thread starter Dinmar via AccessMonster.com
  • Start date
D

Dinmar via AccessMonster.com

can anyone give me a simple code in creating a countdown timer in ms access
2003? Thanks
 
T

tina

not sure if this is what you're looking for...

i have a form with a hidden unbound textbox control named txtTime, and a
visible unbound textbox control named txtCountdown. in the form's Load
event, i set txtTime to Now. the form's TimerInterval property is set to
1000 (= 1 second). the following code runs in the form's Timer event
procedure, as

Private Sub Form_Timer()

Dim lng As Long, sec As Long

lng = DateDiff("s", Nz(Me!txtTime, Date), Now)
If 60 - (lng Mod 60) = 60 Then
sec = 0
lng = lng - 60
Else
sec = 60 - (lng Mod 60)
End If
lng = 14 - Fix(lng / 60)
If lng < 1 Then Me!txtCountdown.ForeColor = 255
Me!txtCountdown = Format(lng, "00") & ":" & Format(sec, "00")

End Sub

the code runs once a second, changing the value of txtCountdown, counting
backward from 15:00 minutes to 00:00, and changing the forecolor of
txtCountdown to red when less than one minute remains in the countdown.

hth
 

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