Time Stamp on Form Fields

J

JOE POLLOCK

I have a form which I have developed for a customer relations db. I would
like to have a field on the form which,when a record is opened or a new one
began, would display the time automatically. A second field would display
the time when the record was ended. I want to do this automatically to avoid
any data corruption or modification by non administrators.
 
W

Wayne-I-M

Hi Joe

You need to give more information about your application to get an answer.
The new reocrd "stuff" is simple (if you have somewhere to store the
date/time)

If Me.NewRecord Then
Set the value of some field to Now()
Else
Do something else
End If

You need to give more information about this
when a record is opened or a new one
began, would display the time automatically
Do want to store the date/time when the record is altered (overwritting this
dat each time) - or something else?


and this (how do you know when it's done ?)
second field would display
the time when the record was ended.

So post back with more info and someone will be answer to offer some advice
 
J

JOE POLLOCK

I have been able to arrive at a solution for the time a record was begun.
What I need to know how to do is create the code or an expression to stamp
the record as to when that was ended.
 
J

JOE POLLOCK

For example, if I receive a call from a client. I open this contact form and
begin typing their contact info and reason for call. Once I have finished the
call I want to have a field that will time stamp when I have finished that
call. The purpose is to record when the call began and ended to audit time
spent.
 
J

John W. Vinson

For example, if I receive a call from a client. I open this contact form and
begin typing their contact info and reason for call. Once I have finished the
call I want to have a field that will time stamp when I have finished that
call. The purpose is to record when the call began and ended to audit time
spent.

The problem there is that there is nothing to prevent you from entering data
into all of the controls on a form, and just *leaving the form open* - for ten
seconds, for five minutes, for the weekend.

You can certainly use the Form's BeforeUpdate event to timestamp the moment
when a record is committed to disk (by moving to a new record, by typing
shift-enter, by closing the form, etc.):

Private Sub Form_BeforeUpdate(Cancel as Integer)
<do any record validation first>
Me!txtTimeUpdated = Now
End Sub

but there's no easy way to compel the user to in fact save the record.
 
W

Wayne-I-M

OK

You need another table - to store the times
tblCallTimes
CallID = autonumber
ClientID = number
CallStart = Time/date (full)
CallEnd = Time/date (full)
plus any other stuff diectly linked to "this" call. eg. all taken by, dept,
notes, etc
Link this table with your client table (or who ever you are taking the call
from)
Set the value of the these fields when the form is opened and closed
 
R

Richard

JOE POLLOCK said:
I have a form which I have developed for a customer relations db. I would
like to have a field on the form which,when a record is opened or a new one
began, would display the time automatically. A second field would display
the time when the record was ended. I want to do this automatically to avoid
any data corruption or modification by non administrators.

Not sure if this is what your looking for but check out Al's web page on
Record Statistics. Date of creation, Date of last edit.

http://home.comcast.net/~cccsolutions/accesstips.html

HTH
Richard
 

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