Global Error Handling?

J

Jason Gyetko

I know you can handle errors using the On Error process within
Functions and Subroutines, but is there a way to say that if an error
is encountered on any form, report, etc then go to one common function
to handle it? Thanks!
 
D

Dirk Goldgar

Jason Gyetko said:
I know you can handle errors using the On Error process within
Functions and Subroutines, but is there a way to say that if an error
is encountered on any form, report, etc then go to one common function
to handle it? Thanks!


No, unfortunately not. You can create your own function to do common
error-processing, but you still need an error-hander block in every
procedure to call it. There are tools you can use (MZTools, for example) to
insert standard error-handling into all procedures in your database.
 
J

Jason Gyetko

No, unfortunately not.  You can create your own function to do common
error-processing, but you still need an error-hander block in every
procedure to call it.  There are tools you can use (MZTools, for example) to
insert standard error-handling into all procedures in your database.

Thanks, do you know if there is a way to put error handling that
occurs on table access rather than by individual procedure or at least
a way to call a function on table access?
 
D

Dirk Goldgar

Jason Gyetko said:
Thanks, do you know if there is a way to put error handling that
occurs on table access rather than by individual procedure or at least
a way to call a function on table access?


No, that's not something you can really do in Access. I can think of a
possible workaround for calling a function on table access. It would be
possible to create a query that selects all fields from the table, and has a
calculated field that calls a VBA function. If you use that query in place
of the table, wherever you might refer to the table, then the function would
be called when the table is queried. You could set it up so that the
function is called once for every record, or only once for the whole table.

I haven't tried this, so I don't know what quirks might be encountered.
It's an unusual request, so I would hope you have a very good reason for
wanting to explore these uncharted waters.
 
Top