Automate Error Handling

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all,

I have several combo boxes on a form that all have selections available to
choose from. The problem I see happening is a user will make a selection,
then decide to backspace over the selection and move to a different control
on the form. As a result error 3075 is generated.

I have code to handle the error, but it's redundant code because I have to
use it for each combo box.

Is there a better way to handle such an error without having to use the same
code over and over for each combo box? I was thinking that calling a
function when the error occurs might be better suited in this situation.

Can someone please advise and provide a coding example. Will be greatly
appreciated :-)

-A
 
Calling a generic error handler works very well, provided your function
understands each situation that could generate that error.

There's an example of a generic function in this link:
http://allenbrowne.com/ser-23a.html

The function actually logs all the errors to a table. Users never tell you
what error they saw, so it provides a way of keeping track of whatever
errors your application is seeing, as well as providing a way to Select Case
on the particluar error number and handle it in a particular way.

The last piece of the puzzle is then a VBA add-in that lets you drop in a
configurable error-handler into any procedure by clicking a toolbar button.
You can download one from mztools.com.
 
Back
Top