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!

Display current time 1

Status
Not open for further replies.

Chew407

Technical User
Mar 28, 2005
92
CA
Hello everyone.

I tried searching the forum for this but had some trouble finding anything. Is it possible to display the current time, active to the second (you can see the seconds move)?

Any help you can provide would be much appreciated. Thank you.

Chew
 
MajP,

I followed the directions in that link exactly and I'm receiving an error:

The expression On Timer you entered as the event propoerty setting produced the following error: A problem occured while RPD was communicating with the OLE server or ActiveX Control.

Am I missing an ActiveX Control or something?

 
Try creating this on a blank form with just a label and see if it works. No idea on that error. Works fine for me. Something else may be going on with your form
 
MajP,

I removed the Record Source from my form and the clock began to work. I need the Record Source in there. Is there a way around this?
 
You should be able to have your recordsource. There is something else going on. Do you have other calculated controls? Do you have a active x control on the form besides the Access native controls?
 
Here's a thing I've used for years, v2000-v2003, with calculated controls as well. You'll need a textbox called txtOmega (yeah, I'm a watch fanatic) and you'll maybe want to add some cosmetics to it, like a frame around it. If you'd also like to show the date, add a textbox called txtDayRunner and uncomment the line

'e.txtDayRunner = Date 'Display date

Goto your form's property box. Under the Event Tab find Timer Interval and enter 1000. Now use this code:

Code:
Private Sub Form_Open(Cancel As Integer)
'Displays while waiting for timer to crank up    
     Me.txtOmega = Time 
End Sub

Private Sub Form_Timer()
    Me.txtOmega = Time 'Display time
   ' Me.txtDayRunner = Date 'Display date
End Sub

If this, too, doesn't allow you your recordsource, I don't know what to tell you


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
I doubt that is going to make any difference, it is the same thing using a text box instead of a label.
 
Thanks Missinglinq but I get the same result... although I do like the idea of displaying "Time" while the clock loads.

MajP, I am looking into the questions you raised. Thanks again.

Chew
 
Still looking into the problem but I find that the following works really well:

Code:
Private Sub Form_Open(Cancel As Integer)
    Me.lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss")
End Sub

Private Sub Form_Timer()
    Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss")
End Sub

I'll let you know what I find with the record source issue.

Chew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top