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!

How do I add a basic clock?

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
I can't find my code anywhere that had this, but, I'm trying to remember how to add a running clock on my access form. I did it before where it basically was the date and time (hh:mm:ss). I remember having to set something in the properties to 1000....anyone have any suggestions?

Thanks.
 
I think what you did was to create a textbox on the form and then set the form's event timer interval to 1000 milliseconds. The form's timer event procedure will then update the textbox to the current time. Something like this:

Code:
Private Sub Form_Timer()
    Me.txtClock.Value=format(now(),"hh:nn:ss")
End Sub

Ed Metcalfe.

Please do not feed the trolls.....
 
Yes..that was exactly what I did! Thank you! Been a little rusty lately.
 
Ok..one more thing....what do I do again to get it to display in 12 hr format. So instead of 15:00 it displays 3pm?

Thanks again.
 
Add am/pm to the format:

format(now(),"hh:nn:ssam/pm")
 
Code:
format(now(),"hh:nn:ss AM/PM")

Ed Metcalfe.

Please do not feed the trolls.....
 
lol. Damn Remou, you're fast. :)

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top