Is it possible to stop the Update in a Before Update event?

  • Thread starter Thread starter Randi W
  • Start date Start date
R

Randi W

I am making a form to edit a table where one field is required. If the user
tries to update without having put a value into this field she gets a "ugly"
error message saying:
"The field <fieldname> cannot contain a Null value because the Required
property for this field is set to True. Enter a value in this field."

I thought I could do a test on the "Before Update" event. If
IsNull(<required column>) then I would give a more user friendly message.
BUT - then I would like to stop the save operation, otherwise the default
error message will pop up after my message..

Is it possible to stop the Update?

Thanks for any help on this,
Randi W.
 
Randi

In the design view of the table, set the Required property of the field
in question back to No, and instead set the Validation Rule property to
Is Not Null and teh Validation Text property to whatever pretty message
you want the user to see if he doesn't put something in there.
 
Yes. Note the Cancel variable in the argument list for the BeforeUpdate
procedure. Setting that variable to True will stop the update.

Cancel = True

So insert this code line in your code when you want the update to not occur
based on your test.
 
Back
Top