[AccessD] [SPAM SUSPECT] Error Trapping

Steve Capistrant scapistrant at symphonyinfo.com
Thu Aug 3 11:37:24 CDT 2006


Dan,

Maybe you already know this but, just in case... One option is change
your subprocedure(s) into a function, returning a Boolean value.
Default it to return FALSE, by putting this near the top:
	MyFunction() = FALSE
On the very last line of the code, before the error handling section,
put:
	MyFunction() = TRUE
In the error handling section, make sure you insert a developer
controlled comment in the msgbox, like:
	"Error occurred in MyFunction"

Finally, on the parent procedure, call the subfunction with this:
	If MyFunction() = False then GoTo ex

In this way, you can always know at what level the error handling is
triggered, and gracefully shut down the calling context too.

Steve Capistrant
Symphony Information Services
scapistrant at symphonyinfo.com
www.symphonyinfo.com
Office, Twin Cities: 763-391-7400, ext. 801. 
Office, Toll free: 888-357-1373, ext. 801
Direct: 612-237-0075
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Wednesday, August 02, 2006 12:31 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] [SPAM SUSPECT] Error Trapping

Well, I typically have Error Trapping set to 'Break on all Unhandled
Errors'.  I'll change to 'Break in Class Module' to see if that does the
trick.

Thanks!

Dan 
 

-----Original Message-----
Subject: Re: [AccessD] [SPAM SUSPECT] Error Trapping

There can be a couple of issues here.  One is as stated, if you have "On
Error Resume Next" active when you invoke a sub or function then errors
in
the lower level routine will kick back to the upper level.  The other
issue
is that if you invoke a method in a class module, even without On Error
active, what happens depends on the setting Error Trapping option in
VBA.
If Error Trapping is not set to "Break in Class Module" then the error
will
be trapped in the routine that invoked the method.

Regards,

Steve

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list