9 replies
by tom
Insert =Time() into a text box or label
then refresh the box every sec or so
by ainee
by simonchan
by ainee
by mbarker734
On your form create a text box. Set the control source of this text box to: =Time()
This set the text box to system time.
Create an event procedure in the On Timer area of the form. Place this line in the event: me.refresh
Every time the event procedure is called the code will be run and refresh the display.
In the Timer Interval of the form place the number: 500
The Timer Interval is the number of miliseconds that will pass before the On Timer event will occur.
You may have to adjust this number dependant upon your processor speeds but, you can cause it to the Timer Interval to be near one second.
I would also suggest setting the tabs so that the text box is not the active control on the form. This will provide for a less flickering effect.
Good luck,
Mark
by ainee
by mpdcsup
In addition to Now(), you will find Format() useful in formatting the display.
Rather than a bound control, I would use a label to display the time.
Create a timer control (or for Access 97, use the Form_Timer Sub) and set the Timer.Interval (or Form.TimerInterval for '97) to 1000 milliseconds (1 second).
In the Sub handling the timer event, excute the following line:
MyLabel.Caption = Format(Now(), "hh:nn:ss")
In the Table definition add the field for your CurrentTime and set the default value to =Now()
Don't bother trying to save the date/time from the form to the database (the default will take care of giving the record an appropriate date/time value when the record is created).
by ainee
by ainee
This discussion is closed to new replies.
Trending Software posts
Sort by Trending