Continuously Updating the Time of Day

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a time of day box on it. It updates when the form is
opened but I'd like to have it continuously updated to show the current time.
Anyone have a solution for this?
 
I have a form with a time of day box on it. It updates when the form is
opened but I'd like to have it continuously updated to show the current time.
Anyone have a solution for this?

Have the time updated in the timer event.
 
I have a form with a time of day box on it. It updates when the form is
opened but I'd like to have it continuously updated to show the current time.
Anyone have a solution for this?

Use the form's Timer event. In the form properties set the timer interval to
1000 (1000 milliseconds, 1 second) if you want the time to the second, or to
60000 if you want it to the minute.

Then on the Events tab click the ... icon by the Timer event, and choose the
Code Builder; edit the code to

Private Sub Form_Timer()
Me!txtShowTime = Now
End Sub

or if the box is a Label,

Me!lblShowTime.Caption = Format(Now, "hh:nn:ss")


John W. Vinson [MVP]
 
I have a form with a time of day box on it. It updates when the
form is opened but I'd like to have it continuously updated to
show the current time.
Anyone have a solution for this?

Why? It seems to me to be a complete waste of effort to use a timer
for that.
 
OK. Works nice. Initially it did not work but then I realized that I had to
delete the control source of =Time() and let the timer event do its job.
Thanks.
 

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

Back
Top