[AccessD] Intentional Errors

Drew Wutka DWUTKA at marlow.com
Wed Mar 12 18:15:01 CST 2003


I have only ever dabbled in C (VC++), but I have lots of experience with VB
and VBA.  The queasy feeling comes from not being able to handle ALL errors
from within VB.  There are times where your code can trigger an error that
you cannot handle.  For instance, if you have a corrupt database, and you
try to open a form that msaccess.exe runs into an unhandled error for, then
your code will fail, and Access will shut down.

Granted, knowing that you may get an error, that you can handle, and getting
broadsided by something you can't trap are two different things.  And I
don't think I have ever seen an unexpected error in a routine that I
expected an error to be a valid 'response'.  However, it's kind of like the
feeling you may get sometimes in bed, when you feel like you are falling.
You are not falling, but the sensation is there, and it just triggers the
fight or flight response! <VBG>  Know what I mean?

I completely agree that catching 'expected' errors is a very valid method of
writing code...in fact, in some API calls, getting an error is the only
'response' you get back...the error message is the result of the API.

Drew

-----Original Message-----
From: Heenan, Lambert
To: Access-D Email (E-mail)
Sent: 3/12/03 4:39 PM
Subject: [AccessD] Intentional Errors

Would anyone care to try to explain what could possibly be a problem
with
executing code which executes a statement that will either succeed or
will
generate an error, such as the recent "Am I a subform?" thread.

As long as the error is being trapped, what would make anyone "uneasy"
about
this technique. To me it seem a perfectly valid approach, and to anyone
who
has ever written C++ or Java code it's second nature. That's what
exception
handling is all about.

Try {
	//Some Code that might Error
}
Catch {
	//Handle the error condition
}


Lambert 
_______________________________________________
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