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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Current Time to a Form?? 2

Status
Not open for further replies.

natemclain

Technical User
Jun 19, 2001
68
US
How in the world can you add the current time to a form(Switchboard) so that it keeps updating? I have in the textbox in the control source this =Time()
But that just gives you a one shot clip of the time. Is there away to make the time continuously update??
Just wondering how you can do it.


TIA

natemclain
 
Use the OnTimer event of the form to update your control

txtTime = Time

Add a value to the Timer Inverval, 1000 will cause the OnTimer event to run every second
 
use the Forms OnTimer Event, Set the TimerInterval to 1000 (1 second), and for the OnTimer Event add

YourTextBoxName = Time

PaulF
 
Thanks guys that is exactly what I was looking for.

natemclain
 
That is great guys. But I have one last question.
In the properties of the text box there is no OnTimer event. I have seen this before but when I checked it there wasn't one there. What is the deal? Do ya have any idea?
 
Both On Timer and Time Interval are found on the FORM properties sheet on the events tab
 
Hey 930driver,

Im now getting a Error now it says:
Microsoft Access can't find the macro 'txtTime=Time'
The macro(or its macro group) doesn't exist, or the macro is new but hasnt been saved. Note that when you enter the macrogroupname.macroname syntax in an argument, you must specify the name the macro's group was last saved under.

Do you have any idea what the heck that is all about??

natemclain
 
You need to enter the code snippet into a VBA window, if you just paste it into the property sheet it looks for a function or macro with that name.

Click to the right of the On Timer event. Select Event Procedure. A VBA code window will open. Paste the 'txtTime = Time' code snippet into the Form_Timer event. Change 'txtTime' to the name of the control on your form where you want the time to appear. Save and re-open your form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top