Here is some code relative to displaying a clock/time (digital) on the
form.
If you have a hidden txtbox with the start time then you could change
the visible time by subtracting the hidden one from the visible one on
the update. When you stopped the time, the visible one would then have
the time involved.
You may want to consider simply converting the display instead to just
be a number that you increment on the timerevent. Change the interval
to be the number that represents 30 seconds and then have the display
"time" just be a decimal number that you add .5 to at the timer
interval. When you start set the display to 0 and the timer interval
to 30 seconds. At the interval add .5 and then when you stop move 0 to
the timer interval and save the accumulated number to whereever you
want.
Things to think about.
Can they restart the counter/timer by moving off the record? or hitting
start again (enter the first field again)? What if they accidentally
tab into the start? If you use the table field to hold the data, what
if their computer crashes or the network connection goes south, can
they restart. If they do restart, is it accumulative or replacing.
The juggling act is how to allow for crashes but cut back on mis-use -
particularly if they are being judged on it.
Create a clock on a form
Author(s)
Dev Ashish
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.
'***************** Code Start ***************
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
'***************** Code End ***************