How do I deal with a before update event

  • Thread starter Thread starter Frederick Wilson
  • Start date Start date
F

Frederick Wilson

Hello all,

I have a form where I input facility information.

In the form's before update event I check the required fields to ensure
there is data there, among other things.

On the txtFacName ctr I use the Exit event to check if that FacName is
already in the DB. If it is I reset to focus to txtFacName with a msgbox
telling that the FacName is already in use.

If the user decides to cancel the input or deletes everything and then
clicks cancel the Before Update event still fires and gives a warning
that a FacName is required. When you cancel this, I get a system warning
that the record can not be saved because FacName can not contain a null
value.

THE QUESTION:
What is the normal order to handle this situation?
 
Hi Frederick,

I've run into similar problems when dealing with a REQUIRED field. Access
won't let you set it to NULL and move on. When you define the attributes of
the field in table design view perhaps you could assign Indexed = "Yes (No
duplicates)" and let Access deal with checking for duplicates and informing
your user that a duplicate value is not allowed.

HTH -Linda
 
It sounds like something wrong with your code for "Cancel".

If you use the Undo Method on the code for "Cancel", the Form_BeforeUpdate
Event shouldn't even fire.

If you need further help, post the code for "Cancel".
 
Back
Top