DoCmd.ClearMacroError method (Access)
Removes information about an error that is stored in the MacroError object.
Syntax
expression.ClearMacroError
expression A variable that represents a DoCmd object.
Remarks
When an error occurs in a macro, information about the error is stored in the MacroError object. If you have not used the OnError action to suppress error messages, the macro stops and the error information is displayed in a standard error message. However, if you have used the OnError action to suppress error messages, you may want to use the information stored in the MacroError object in a condition or a custom error message.
After an error has been handled, the information in the MacroError object is out of date, so it is a good idea to clear the object by using the ClearMacroError method. This resets the error number in the MacroError object back to zero, and clears any other information about the error that is stored in the object, such as the error description, macro name, action name, condition, and arguments. This way, you can inspect the MacroError object again later to see if another error has occurred.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.