Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

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