• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

How do you keep time ticking on a form?

How do you keep time ticking on a form?

I have the following code on my form.

=Time()


Is there a VB that will keep the time ticking?
0
tachiinii
Asked:
tachiinii
  • 3
  • 2
1 Solution
 
shanesuebsahakarnCommented:
Change the box to unbound (remove the control source). Set the form's TimerInterval property to 1000 (which is 1 sec). Now, in the OnTimer event, put this:

Me!MyTextBox=Time()

That should do it.
0
 
tachiiniiAuthor Commented:
I'm having problems?

What would te code look like in steps?  THis is what I have so far:

Private Sub txtTime_BeforeUpdate(Cancel As Integer)

OnTimer

End Sub
0
 
shanesuebsahakarnCommented:
No, it doesn't go in the BeforeUpdate event.

Bring up the properties of the text box. Go to the Event page. Find the Timer Interval property. Change it to 1000. Now, on the same page, click in the OnTimer row. Click the build "..." button and choose Code Builder. Paste this between the Sub and End Sub lines:
Me!txtTime=Time()

That should do it.
0
 
tachiiniiAuthor Commented:
I'm in the events page of Proerties for the unbound text box and I don' see anything for the Timer Interval property?  
0
 
shanesuebsahakarnCommented:
Both TimerInterval and Timer are form events, my mistake. Design your form and bring up the properties page. You should see them on there under the Event page, near the bottom.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now