Disable Action Failed Macro Message

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

Guest

On a form, I have a macro attached to a command button that saves the record
and previews a report. If a field is not filled in according to the
validation rule for that field at the time the user clicks the button, the
Validation message appears and then the "Action Failed" message for the macro
appears. The user has to click on "Halt" to continue. Is there a way to
disable this macro message?
 
No, not directly. The error is not caused by the macro, but rather the macro
is failing because the validation test failed on the form. The way to avoid
the message is to not run the macro unless all the validations are ok.

I assume that you're using either table-level validation rules and/or
form-level validation rules. The only way to "trap" them is to use VBA code
in the form's Error event to test for and "swallow" those error messages.
But then you'd need to conduct the validation test in a different way
because it's obvious that you cannot save a record with invalid data.

Perhaps, you could remove the validation rules in the table and/or form, and
use a Condition in the macro to test for the validity of the data as the
first step; if the test fails, display an error message and stop the macro.
 
Back
Top