Hi,
Is it possible to force an access procedure to enter the debugger and break
when there is an error? I'm trapping errors using the standard errorhandler
methods, but I am stuck in a loop, and I would like to find out where the
problem is.
Is there any code that I could place in my error handler to force vba to
stop running code and enter the debugger iwhen it encounters a particular
error number?
Here's what my error handler looks like now...
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & Err.Description
Resume ErrorHandlerExit
In this case I get an Error# 91, but when I hit the ok button on the MsgBox
the program immediately gives me the same error again.
- David
david101 - 15 Jun 2007 00:46 GMT
I think there is a property called "AllowBreakIntoCode" but I'm having some
trouble finding a good example.
> Hi,
>
[quoted text clipped - 20 lines]
>
> - David
Ofer Cohen - 15 Jun 2007 00:48 GMT
When you get an error message press Ctrl+Break, that will stop the code and
will locate the debuger to this line (yellow line):
Resume ErrorHandlerExit
Cange it to (adding single quote)
Resume ' ErrorHandlerExit
so it wont exit the sub
Hit the F8 key, to step through the code
The Resume will move the debuger to the line that got the error
Hints:
F8 used to step line by line in the code
F5 used to run the code without steps
F9 used to insert a code break or undo the code break where the cursoris
located in (red line)
Note:
don't forget to change this
Resume ' ErrorHandlerExit
Back to this
Resume ErrorHandlerExit

Signature
Good Luck
BS"D
> Hi,
>
[quoted text clipped - 20 lines]
>
> - David
Dirk Goldgar - 15 Jun 2007 17:50 GMT
> When you get an error message press Ctrl+Break, that will stop the
> code and will locate the debuger to this line (yellow line):
[quoted text clipped - 20 lines]
> Back to this
> Resume ErrorHandlerExit
Ofer, I don't think it's a good idea to modify code while the
application is running. That has been known to lead to corruption of
the VB project.
I suggest instead that David simply set one or more breakpoints in his
code, so that the code stops at the breakpoint(s). Then he can
single-step through it to investigate the problem.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)