START AND STOP TIME ENTRY

J

Jim

I have a form in which I wish to automatically capture a start time and the
actual stop time of an entry. I have tried several different approaches but
cannot get the stop time accruate without manual entry. Ideally I'd like to
stop time when the record is closed or a new record opened - there will be
multiple users. Any ideas?
 
S

Steve Schapel

Jim,

Would the Before Update event of the form do the job? Or the After
Update event?
 
S

SJ McAbney

In your form's module, put this declaration to the top (just under Option
Compare Database)

Private Declare Function WWindowsStart Lib "WINMM" Alias _
"timeGetTime" () As Long
Dim lngTimeStart As Long
Dim lngTimeStop As Long


In the form's Current event, put:

lngTimeStart = WWindowsStart

In the form's BeforeUpdate event, put:

lngTimeEnd = WWindowsStart
Me.MyTextBox = lngTimeStop - lngTimeStart

Where MyTextBox is the name of the textbox you want to store the value in.
The value returned is in milliseconds.
 
Top