Countdown timer

D

Deltic

I would love to be able to display a countdown timer on my form that
shows how long to go before the 2012 olympics, the timer would need to
have a facility to put in a time and date that the games start then to
display the days , hours minutes left. Is this possible ?
Thanks
 
L

Linq Adams via AccessMonster.com

In Design View, goto Properties - Events and set the Timer Interval to 1000.
This will cause the value to display one second after the form opens; to
decrease the delay, decrease the Timer Interval, but don't go below 200 or so.
To short a cycle can sometimes cause flickering of controls.

Create a textbox named TargetDateTime and one named TimeLeftUntilOlympics.

Private Sub Form_Timer()
Days = DateDiff("n", Now, Me.TargetDateTime) \ 1440
MinutesLeft = DateDiff("n", Now, Me.TargetDateTime) Mod 1440
hours = MinutesLeft \ 60
Minutes = MinutesLeft Mod 60

Me.TimeLeftUntilOlympics = Days & " Days " & hours & " Hours " & Minutes & "
Minutes"

End Sub
 
F

fredg

I would love to be able to display a countdown timer on my form that
shows how long to go before the 2012 olympics, the timer would need to
have a facility to put in a time and date that the games start then to
display the days , hours minutes left. Is this possible ?
Thanks

I don't remember the exact day and time the 2012 Olympics starts, but
let's say it's 08/20/2012 7:00 PM

Copy the Diff2Date function from

http://www.accessmvp.com/djsteele/Diff2Dates.html

and paste it into a module.

Then you can call it from an unbound control on a form:

=Diff2Dates("ymdhns",Now(),#8/20/2012 7:00:00 PM#)

Each time you open or refresh the form (by navigating to the next
record) , the years, months, days, hours, minutes and seconds will
appear.

3 years 11 months 19 days 10 hours 34 minutes 47 seconds
 

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