Time and date display

  • Thread starter Thread starter J.J. Richardson
  • Start date Start date
J

J.J. Richardson

I need to display the current time and date with the time
continually up dating on a form. I have it set up now,
when the form is opened the time and date are displayed.
The problem is that the time displayed is he time the form
was opened not the current computer clock time. i need
this time displayed to match the computer clock at all
times
 
Hi,

1. Create a new label on the form.
Just put Time in the caption for now (it won't show later)
Name it lblClock

2. On the form's properties list go to the Event or All tab and put 1000 on the "Timer
Interval" line.

3. On the "On Timer" line click the (...) button to go to the code window.

4. Fill in this code in the Form's Timer event:

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

5. Compile the code, close and save the form.

6. Open the form and the label should now be displaying the current time by seconds.

7. Adjust any formatting you would like.

Hope that helps,
Jeff Conrad
Access Junkie
Bend, Oregon
 
Back
Top