Events to "Trap" Incomplete Record Creation?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following scenario that's causing a problem:

(1) Joe CluelessUser is adding a new record to a database through a form.
(2) He fills in some fields, then gets distracted by something else, with
the form and the incomplete (still missing some required fields) new record
on his screen.
(3) Quitting time rolls around, and Joe C has never completed his new
record. He logs off and goes home, and his new record goes into byte heaven
because of the missing required data.
(4) Two weeks later, Joe C goes looking for his record, finds it ain't
there, and beats me up because my database deleted all his hard work.

So I want to build in some kind of timer event that will (a) note when
someone begins to add a new record, and (b) pop up a modal warning message at
some point reminding him that he has to finish the new record if he expects
it to be saved.

Who can suggest to me what events could be used for this purpose?
 
When you say 'logs off and goes home', do you mean switches off his/her PC
while the Access DB is open? If so, there is no way you can prevent that.
That is an educational and discipline issue. I'd inform his manager since
doing that could corrupt the database.
If you mean they logoff properly and the record is lost, then its back to
your problem. In the BEFORE UPDATE event for the form perform all the
validation checks and issue a message if anything is missing. Regardless, you
should not allow saving an invalid record. They should either have to modify
the record to be valid or click CANCEL after receiving a warning that all
entered data will be discarded.

-Dorian
 
I imagine all possible ways of doing it wrong are in play! ;>) If the guy
literally just powers down his PC, then indeed I need to get someone to come
down on him about it. But in our environment, possibility #2 is
Start-Shutdown-Log Off xxxxx or Start-Shutdown-Shut Down or
Start-Shutdown-Restart. In all of those cases, best I can tell, our system
architecture at least attempts to close any open applications. I know that
in some cases I get a "do you want to save your work" message, although I
don't recall ever getting one for MSAccess.

So anyway, to get back to your suggestion, would BeforeUpdate fire in any of
these shutdown situations? My thinking has been that it would NOT, therefore
I need something to start watching any time a user starts to add a record,
and to nag him with a modal popup he can't ignore if he remains in the
"...adding new record..." mode for an unreasonable length of time. Back to
you to set me straight, and thanks for your ideas so far.
 
Larry,

Create a Public variable at the form level (right after the Option
statements and before any other code) called AllowClose (Dim AllowClose as
boolean)

In the forms Open event, set AllowClose = False

In the forms Unload event test for the AllowClose parameter

Private sub Form_Unload(Cancel as Integer)

Cancel = Not AllowClose

If Cancel = True then

msgbox "Close the form using the close button"

End if

End Sub

To make this work, you will need a close button on the form and in the click
event of that button you will need to set AllowClose = True, then execute the
forms Close method.

This should prevent Access from closing. It also prevents the user from
closing the form using the X button (assuming it is enabled).

HTH
Dale
 
Back
Top