(Solved) – MacroError VS. Err in VBA

  • by
(solved)-–-macroerror-vs.-err-in-vba

When would you use MacroError in Access VBA code?

I have always used the Err object for error handling. I recently came across some VBA code that had uses the MacroError object instead. I read the MS doc on this object and it has a note:

The MacroError object does not contain information about run-time errors that occur when running Visual Basic for Applications (VBA) code.

Which is odd because the usage of MacroError I was looking at was in a VBA procedure and it was used right after a DoCmd call to check If MacroError.Number <> 0. Shouldn’t we use Err for this?

REFERENCE:
https://docs.microsoft.com/en-us/office/vba/api/access.macroerror

Leave a Reply

Your email address will not be published. Required fields are marked *