Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time 1

Status
Not open for further replies.

MattBeas

Programmer
Nov 15, 2001
17
GB
Hello!
Could anyone advise me on how to display the time in a textbox like a clock.
I can manage to get the time but can not get it to continually update itself.
thanks!!
 
you need to use the on timer for this function. in the on load section of the form set you timer to 1 second or 1000 millisecond

timerinterval = 1000

then in the timer section of the form enter
[field name].requery

once you run the form you clock will update every second

 
Jamie:

Just tried this. Had to put txtTime = Time()in the On Timer event to make it work.

Neat trick. Thanks.

(Tried to give you a star but got an error message.) Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
actually i forgot to mention this bu inside the unbound text box make the control source equal to the following

=Format(Date(),"Long Date") & " " & Format(Time(),"Long Time")

then the code i told you before should work perfectly
 
Jamie:

Neat approach.

I set the control's default value to Time(), set the form's Timer Interval to 1000 and created an event procedure for the form's On Timer with the code txtTime = Time().

Works great with the exception that the first time the timer activates the time jumps about six seconds instead of one.

Give six programmers the same problem and you'll get twelve different solutions. Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top