checking whether a record has been dirtied in the last 60 secs

  • Thread starter Thread starter John Baker
  • Start date Start date
J

John Baker

Is it possible to check that a record on a form has been dirtied in a the
last lets say 60 seconds. I have a form which usually sits on the same
record for most of the day. I want to check if a record has been changed
recently as opposed to being changed earlier in the day. I am thinking of
using the timer event and the ondirty event.

Any help greatly appreciated.

John Baker
 
John said:
Is it possible to check that a record on a form has been dirtied in a the
last lets say 60 seconds. I have a form which usually sits on the same
record for most of the day. I want to check if a record has been changed
recently as opposed to being changed earlier in the day. I am thinking of
using the timer event and the ondirty event.


The Dirty property will tell you if the record is dirty.
However, the Dirty property, not the Dirty event will tell
you if the record has been changed again recently. You
would need to use every bound control's AfterUpdate event to
set a time variable.

You can use the form's AfterUpdate event to set a flag
variable to indicate that the record was changed and saved.
So, even if the form is not dirty, you can tell if it was
dirty recently.

Unfortunately, the user can undo any changes without you
finding out about it.
 
You could use the forms timer event to test the value of the controls after
some specified time interval.

I would probably create a user defined data type to store the values of all
the fields in the form in the forms current event. Then, in the timer
event, loop through each of the controls and compare its value to the values
in your data type. If something has changed, retain the change in the user
defined data type, and set the value of some variable (LastChange) as NOW().

If the form sits on the same record for most of the day, who would make
changes to the values on this form? Wouldn't they know when they made
changes? Or is the data accessable by others? If it is, then you need to
put some code in the forms timer event to refresh the RecordSource every so
often anyway, so that you will see the changes that other users make to the
data.

HTH
Dale
 
Back
Top