To put a simple text clock on a form, create a Label
called lblClock on the form, set the form's TimerInterval to 1000, and the following code behind
the Timer Event.
You can also create two command buttons called cmdClockStart and
cmdClockEnd and attach respective code to each to have the clock run on demand.
Private Sub Form_Timer()
Me!lblClock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
End Sub
Private Sub cmdClockStart_Click()
Me.TimerInterval = 1000
End Sub
Private Sub cmdClockEnd_Click()
Me.TimerInterval = 0
End Sub
|