Before Update, Before Insert, and On Dirty event ?'s

D

Dennis

Okay, I use Access2002.

I need to know EXACTLY what triggers these form events:

Before Update, Before Insert, and On Dirty

let me tell you why. On a security application I'm developing, I want the
security officer to have 15 minutes in which to EDIT a new incident report.
After that, it must be edited (and deleted for that matter) by a supervisor.
What I'm trying to do is determine how to CANCEL an attempted edit once the
time-limit has expired. (I also want the code to provide a MSGBOX telling the
officer that a supervisor needs to edit, but that's trivial.)

I have a date/timestamp that I'm going to write out on the initial post of
the record. After that if they try to change anything, I DO NOT want that
operation to complete. I want it to CANCEl if they: 1) try to move to another
record, 2) try to post the edits.

So can someone please offer me some specific information? IIRC, the INSERT
event fires before/after a new record is added, and the UPDATE event fires
before/after an EDIT. But I believe the UPDATE event also fires for a new
record as well. And what about the DIRTY event? IIRC it fires the moment a
single character gets changed in the form. And what if the user attempts to
close the application? Can that get past the events in some way?

I think I have some of these answers, but would like some independent
confirmation please.

Thanks!!
 
M

mscertified

All of that is explained pretty well in Access HELP.

Why cancel the edit one the time limit has expired? Why not detect those
records in the 'on current' event and prevent them being edited in the first
place? Far simpler.

Personally, I think applications in which time is used to determine what can
happen are a poor design. I can think of all kinds of instances where your
design will fall down.

-Dorian
 
D

Dennis

The officers may need to lookup the records at any time after-the-fact. They
need to be able to see them. The timeout for edit is a requirement of the
security dept. If you can think of a better way to allow editing for a brief
time (while the record is "fresh"), but then keep them from changing it
later, I'm MORE than willing to listen to alternative methodologies.

If in the on current event, what would I need to set/clear in order to solve
this issue? They DO need a small window in which to edit the record(s).

Thanks!
 
M

mscertified

Are you saying that when the record is initially created, assuming the user
just sits on the record, you want to either allow or disallow the save
depending on how much time has elapsed? Sounds like a strange design. So
sometimes a record can never be saved?

If you want to allow an unlimited time for the record to be created and
saved and then only start the clock upon the save, then when the record is
next retrieved you look at the timestamp and either allow view or edit
depending on the time. If this is what you need, look at the Allowedits
property and the Enabled and Locked properties.

-Dorian
 
D

Dennis

No, once the SAVE of a new record is done, that's when the clock starts
ticking. The user can sit there for an hour on a new record (half completed),
but once that record is SAVED ("posted" in my parlance) that's when the 15
minutes begins. I can't use enabled because if set to FALSE the information
is greyed out and hard to read. I suppose I could use the Locked property
though. Sometimes when I try enabling/disabling AllowEdits, I get, um,
"unexpected" results.

Dennis
 
M

mscertified

OK, that makes it much simpler.
In the 'on current' event, check the timestamp, if it has expired and the
user is not a supervisor, set the property to make it view only, otherwise
make it editable. I thinks it's the Locked property that you want. You can
set the colors independently of the other properties by setting the Forecolor
or Backcolor properties (check Access HELP). Access HELP is a good resource
if you are unsure about events or properties.

Remember that your Security depertment may not be able to predict every
ramification of a requirement they are demanding.

-Dorian
 
D

Dennis

Thank you. I don't see Locked as a property on a form. But the AllowEdits
seems to be working, near as I can tell. Thanks for helping. Oh, and as for
the ramifications? That's their problem. I have a conditional that allows a
person with supervisory capability to not be subject to the time limit. So
after it expires, requested edits would all be done by supervisors. This is a
security precaution to keep potentially disgruntled security employees from
removing or corrupting records. Since in many cases, this data will be used
it crimial trials, it is important that it be as secure as possible.
 
M

mscertified

You would use the Locked property on the individual control where you edit
the text.
 
D

Dennis

I have dozens of fields in multiple tabs. Trying that would be quite a
cumbersome task. Thanks for the clarification however.
 

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