global onError routine

  • Thread starter Thread starter SuzyQ
  • Start date Start date
S

SuzyQ

Is the only way to run an error routine globally without putting an on Error
goto... into every procedure? The programming language (FP) I've used in the
past didn't require this. Once the on error routine was set, it didn't have
to be set in every procedure (unless you wanted to change it for that
procedure) then it would automatically revert to the global on error routine
once the specific procedure was finished. Does Access 2000 have something
like that?
 
Unfortunately, access does not have a global error handling system.

However you can disable the fact that errors will reset the values of
variables in your code.

When your applcaitons get to the point of complexity and having lots of
code, then I would suggest that you split your database into two parts.

You'll than have the application part, and then you'll have the database
part.

Once hyou split your database, then you can work on the next great version
of your software while your current users use the existing application that
you've deployed to their desktops.

The instant you split your database, it gives you the ability to distribute
to your users an mde file. A "mde" application kind of solves your problem
since un-handled errors do NOT reset your variables anymore. Frthermore if
you deploy the application with the runtime system any unhandled errors will
NOT cause the application to shutdown.

So, using a mde (or accDE in 2007) means that all local and global variables
will NOT be lost due to on handled errors.

So while we don't have a global error handling system, if you use an MDE
file, you in effort simply are ignoreing errors anyway.

I do recommend for most code rotuines some errors handling. However, for
tiny bits and pieces of code that opens forms and reports etc, a mde will
alleviate this issue. In many cases using a mde will eliminate the need for
having error handling in every routine that you write.
 
My database is split, and I have a routine that will automatically update the
front end application. However I'm still using an mdb as the front end
instead of mde. I tried creating an mde awhile ago and had problems,
something about conversion. Since it worked with an mdb. I just left it at
that. I will see about creating an mde. I have 2007 at home, but at work
only have 2000. Thanks for you response.
 
SuzyQ said:
Is the only way to run an error routine globally without putting an on Error
goto... into every procedure? The programming language (FP) I've used in the
past didn't require this. Once the on error routine was set, it didn't have
to be set in every procedure (unless you wanted to change it for that
procedure) then it would automatically revert to the global on error routine
once the specific procedure was finished. Does Access 2000 have something
like that?

SimplyVBA Global Error Handler for Visual Basic for Applications
http://www.everythingaccess.com/simplyvba-global-error-handler.htm

However this is a commercial utility.

Alternatively you could use the free MZTools to put in your error
handler code of choice. The downside is that you'd have to click
twice for each subroutine or function you wanted to add your code.

Tony
 
I'll check out your suggestions. I spend last week putting an error routine
in each procedure already though.
 
Back
Top