Inserting Current Time

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

i am trying to find a way to show the current system time
on a form. anyone with any ideas? (2000)

Thanks
 
Hi Simon -

You can also keep your time up-to-date using your form's Timer event. Be
sure to set the TimerInterval property (right under the On Timer event
listed in your form's property box, event tab). The TimerInterval property
counts in milliseconds. If you enter 1000 in the TimerInterval property the
OnTimer event code you enter will run every second, enter 2000 and it runs
every 2 seconds, enter 30000 and it runs every 30 seconds - you get the
picture.

If you use an unbound textbox (let's call it txtTime) like Jim suggested,
you can enter the following line in the Form_Timer event:

Me.txtTime.Requery

Personally, I suggest using a label if you are simply displaying the time.
Also, you may want to consider using just the hours & minutes (Medium
Format), and update the label's caption only every 10 or 15 seconds to keep
background processing to a minimum and reduce annoying screen flicker during
updates (actually seems to be more of a problem with the textbox requeries).
In this case using a label (let's call it lblTime) with a Medium Format,
just add the following line of code to both your form's Form_Timer event and
Form_Open event (so that the user doesn't wait until the first Timer event
to fire to see the time on the form):

Me.txtTime.Caption = Format(Time(), "Medium Time")
 
Back
Top