Embedding 'live' clock in an Access form

DaveWilds

New member
Local time
Today, 04:12
Joined
Jan 28, 2008
Messages
7
Hi, does anyone know of a way of embedding a live clock (either digital or analogue) into a Form?

Thanks, Dave
 
I haven't tried this, but I would imagine you can add a textbox
then add a timer and on the timer's event, you set the textbox's value to now() formatted however you want it..
 
Jeff Conrad has some listed in with the calendars that you might find helpful. Keep in mind that they tend to consume a lot of CPU cycles.
 
I haven't tried this, but I would imagine you can add a textbox
then add a timer and on the timer's event, you set the textbox's value to now() formatted however you want it..

I have done this. A couple of things to watch out for:
1. Windows Timer event is not "exact". That is, you'll need to set the timer interval pretty low in order to get something that "seems" to update every second.
2. Just updating a text field "may" give you a choppy looking clock. I recall using 2 text boxes, and updating them on alternate cycles, and changing their .visible properties.
3. If your program gets busy doing other stuff (a long loop that ties the CPU up), your clock may behave funny. You'll need to put a "DoEvents" in any long loops to eliminate this.

Remember, it was a long time ago when I did this. A lot has changed (cpu speeds, OSs) since then.
 
Keeping in mind Allan's warning about using system resources, here's a thing I use. You'll need a textbox called txtOmega (yeah, I'm a watch fanatic) and you'll maybe want to add some cosmetics to it, like a frame around it. If you'd also like to show the date, add a textbox called txtDayRunner. If you don't want the date, don't use the line

Me.txtDayRunner = Date 'Display date

Goto your form's property box. Under the Event Tab find Timer Interval and enter 1000.

Code:
Private Sub Form_Open(Cancel As Integer)
'Displays while waiting for timer to crank up    
     Me.txtOmega = Time 
End Sub

Private Sub Form_Timer()
    Me.txtOmega = Time 'Display time
    Me.txtDayRunner = Date 'Display date
End Sub
 
Thanks for the various replies and solutions. I will try them out and see what works best.

Cheers, Dave
 
Is this attachment I found "Not Mine" what you are looking for? Or you could use a .swf file thats a clock. In your "More Controls menu" Find Shockwave Flash Object and set the box on your form and name it ShockwaveFlash1 then in your forms OnOpen event add the code below. If its a huge clock file then it slows down your app a little.... Hope this helps! :D

Code:
Private Sub Form_Open(Cancel As Integer)
   Me.ShockwaveFlash1.Movie = Application.CurrentProject.Path & "\NameOfYourFile.swf"
End Sub
 

Attachments

Users who are viewing this thread

Back
Top Bottom