Break On All Errors

When your code contains good error handling and you want to identify which line is actually causing the error you can change temporarily switch on "Break on All Errors".

If you find that error handling procedures do not work on other peoples PC's then it may be because they have their "Break On All Errors" option checked in (Tools > Options). To avoid this use an Addin.
For error handling procedures to work the "Break on All Errors" setting must be turned off.


Break on All Errors

When this option is selected VBA will ignore any error handling code.
This will cause your code to stop on every error.
Stops on every error, even errors following a Resume Next statement.


Break in Class Module

If an error occurs in a class module the debugger will stop on the offending line.
This does not work though when you raise errors using the Err.Raise command.
The Err.Raise command causes an error and makes the debugger stop on this line.


Break on Unhandled Errors

This is the default option
If an error occurs and the error has not been handled then the debugger will stop on the offending line.
If an error occurs in a class module the debugger will stop on the line calling the class rather than the offending line in the class.


Changing at RunTime (Access only)

The error trapping option can be viewed and modified using the Application.GetOption and Application.SetOption methods

Application.SetOption("Error Trapping", 2) 
Debug.Print Application.GetOption("Error Trapping")

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext