Rolling Clock

M

Matt

Is there any way to add a time to a form header that updates automatically?
In essence, replicate the system time into the header.
 
K

Klatuu

Sure, put a text box in the form header. For example purposes, we will call
it txtShowTime for example purposes.

Now set the form's timer interval to 60000 (this is one minute)

Then in the form Timer event:

Me.txtShowTime = Format(Time, "Medium Time")

Medium time will show hours and minutes in 12 hr format with AM or PM. If
that is not what you want, use a differetn format.
 
B

Beetle

Add an unbound text box in the header of your form, with a format of
general date (if you want the date and time), or long time, etc. Name
it, for example, txtClock.

In the forms Open event put;

Me.txtClock = Now()

In the forms Timer event put;

Me.txtClock = DateAdd("s",1,Me.txtClock)

Then set the forms Timer Interval to 1000.
 
J

John W. Vinson

Is there any way to add a time to a form header that updates automatically?
In essence, replicate the system time into the header.

One warning: if you have such a timer (or actually ANY active timer event) in
an open form, you won't be able to use the VBA editor without wierd things
happening (such as the cursor moving or your typing being erased) once every
minute or second, depending on the timer interval. Be sure to close any form
with an active timer, or disable the timer, before attempting to edit code.
 
Top