Disable Action Failed Macro Message



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?

Ken Snell [MVP]

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.

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