Full Version: Global error handler fails when there is an overflow error
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
bobdee
I use a global error handler which I originally got from the Archive. However, it does not seem to handle the overflow error. When there is an overflow error I get an unhandled error in the error handler. Here's typical error handler code (the one shown is used in an Outlook automation routine).

CODE


Exit_Sub:  On Error Resume Next

Set OutlookApp = Nothing
Set objOLNamespace = Nothing
Set objOLTask = Nothing
Set OutlookTask = Nothing
Set OutlookPattern = Nothing
Set outItem = Nothing


DoCmd.SetWarnings True
Exit Function

Err_Ctrl:


DoCmd.Hourglass False
errMsgStr = ""
ctrlfnctnm = "CreateOutlookTasks"
Call Utilities_err(Err.Number, Err.DESCRIPTION, Err.Source, ctrlfnctnm, errMsgStr)
Resume Exit_Sub


The unhandled error stops the code on the following line:

Call Utilities_err(Err.Number, Err.DESCRIPTION, Err.Source, ctrlfnctnm, errMsgStr)

Sorry about the way the code looks. I just can't seem to get the blank lines to show up in the post even though they are there when I create the post.


How can I "handle" this error.

Thanks.
R. Hicks
To get the blank lines when using the code markup .. place your cursor in the blank line and insert a space to the line ...

RDH
KantWin
Howdy!

I have this same problem, and I used the error handler code from the Archive as well.
It appears to be a problem when the error handler is called too many times due to repeated errors in the code. Not the error handler code, but the code where the error occurs.
Other than that, I don't have a solution, sorry.
CyberCow
In A2K3, an overflow should be error #6 and if the error actually is an 'overflow' (#6), then that too should be trappable.

Try setting a condition for #6 (Iff Err.Number = 6 Then . . .)

Please let me know how that works.
bobdee
I think your suggestion would mean putting this If Err.Number = 6 in each local error handler that calls the global. I don't have a convenient way to do this since it's too much text/lines for the Find/Replace and I have hundreds if not thousands of code modules that use the global error handler.

You're right it is error #6 and I don't know why it isn't trapped either.
CyberCow
You should be able to stop it at the global (destination) point, thus avoiding the need to trap it at every level.

Not sure but may be worth a try.
bobdee
No, I don't think that will work. The error shows up in the local module on the line where the call is made to the global module.

Or am I not understanding what you're saying.

Edited by: bobdee on Thu Aug 24 10:01:23 EDT 2006.
CyberCow
I'm afraid that you just might need to modify each module in that case. Speed Ferret is an excellent tool for handling tons of Find/Replace string.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.