Stopwatch Form-Second Request

B

Boconnor

I have created t-he stopwatch in the form and would like
to
1. export the resulting lapse time to an existing field in
a table which the form is linked to.
2. start and stop the stopwatch based on certain
activities which occur on the form (ie: checking a box in
the field to start and stopping when another box is
checked or just entering a new record in the form.

Thanks to all in advance
 
B

boconnor

Although I understand the logic, I don't know how to code
it. Could anyone provide me with the acutal code. Could
the code change if the same command button is used for
start and stop? Any further help would be greatly
appreciated.
-----Original Message-----
Include the [ElapsedTime] field in the Form's record
source and on the form.
Code the Stop command button to pass the value to the
field after the button is clicked, and before the timer is reset to 0.

[ElapsedTime] = [TimeDisplayControl]

The [TimeDisplayControl] should only display the elapsed time,
in hours:minutes:seconds:milliseconds format, i.e.
00:00:01:05
no additional text.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have created t-he stopwatch in the form and would like
to
1. export the resulting lapse time to an existing field in
a table which the form is linked to.
2. start and stop the stopwatch based on certain
activities which occur on the form (ie: checking a box in
the field to start and stopping when another box is
checked or just entering a new record in the form.

Thanks to all in advance




.
 
F

Fredg

I assume you already have a stop watch running properly.
Here is some of the relevant code of what you need to make a stop
watch form that will save the elapsed time to a table.

This uses one command button to Start and Stop the watch.
A second button is used to Reset the clock to Zero.

Add a table to the database.
Add a new field (Text Datatype) to the table.
(Or add a new field to an existing table.)
Name the Field "TotalTime"
* Note.. I've change the name of this field from my previous post to you, in
order to use it within my existing form code.

Add the field to the stopwatch form.
You can make it not visible if you don't want it to show.

Note.. You'll have to convert the control names I use to whatever yours are.

Code the command button event you use to start and stop the clock:

If Me.TimerInterval = 0 Then
' Start the timer counting
StartTickCount = GetTickCount()

' 15 millisecond timer interval
Me.TimerInterval = 15

' Change button caption to Stop
Me!btnStartStop.Caption = "Stop"

' Prevent use of the Reset button while timer is running
Me!btnReset.Enabled = False
Else

' Display the running elapsed time
TotalElapsedMilliSec = TotalElapsedMilliSec + (GetTickCount() -
StartTickCount)

' ** This next line saves the elapsed time to the
' ** [TotalTime] field in the table
' ** [ElapsedTime] is the control on my form that
' ** displays the running time.
[TotalTime] = [ElapsedTime]

' Reset the timer
Me.TimerInterval = 0

' Change button caption
Me!btnStartStop.Caption = "Start"

' Enable the Reset button to permit resetting timer.
Me!btnReset.Enabled = True

End If

You may be using different code to run your stopwatch,
so some of the above may not apply to your situation.
Take what you need.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


boconnor said:
Although I understand the logic, I don't know how to code
it. Could anyone provide me with the acutal code. Could
the code change if the same command button is used for
start and stop? Any further help would be greatly
appreciated.
-----Original Message-----
Include the [ElapsedTime] field in the Form's record
source and on the form.
Code the Stop command button to pass the value to the
field after the button is clicked, and before the timer is reset to 0.

[ElapsedTime] = [TimeDisplayControl]

The [TimeDisplayControl] should only display the elapsed time,
in hours:minutes:seconds:milliseconds format, i.e.
00:00:01:05
no additional text.
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


I have created t-he stopwatch in the form and would like
to
1. export the resulting lapse time to an existing field in
a table which the form is linked to.
2. start and stop the stopwatch based on certain
activities which occur on the form (ie: checking a box in
the field to start and stopping when another box is
checked or just entering a new record in the form.

Thanks to all in advance




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top