On Error statement fails

S

scott w t

in Access 2000, an On Error Resume Next statement fails, by which i mean that
it has no effect ; to test the failure explicitely, i followed the On Error
statement with a line of code that would produce a divide by zero error ; the
code stops at that line as if no error handling had been set ; i have seen
something similar to this before, in that after an ADO error (an error that
is listed in the ADO Connection Errors collection), it is not possible to
reset the error handler in the procedure in which the error occured (in other
words, On Error statements have no effect after an ADO error) ; that is
clearly not the case here because no ADO errors have occured and the ADO
Connection Errors collection is empty ; having written literally 100s of
thousands of lines of VBA code over well more than a decade, i've never seen
this before ; i've recompiled and Compressed and Repaired and rebuilt the
code module, all with no effect ; anyone out there have a clue ?
 
C

Cindy M.

Hi =?Utf-8?B?c2NvdHQgdyB0?=,

You might be better off directing this to a newsgroup dedicated to Access...

It would help quite a bit if you'd copy the lines of code where you're seeing
this. And specify under what kind of circumstances the problem is occurring.

FWIW, I've seen similar behavior if the code is showing a user form, and code
behind the user form fails.
In Access 2000, an On Error Resume Next statement fails, by which i mean that
it has no effect ; to test the failure explicitely, i followed the On Error
statement with a line of code that would produce a divide by zero error ; the
code stops at that line as if no error handling had been set ; i have seen
something similar to this before, in that after an ADO error (an error that
is listed in the ADO Connection Errors collection), it is not possible to
reset the error handler in the procedure in which the error occured (in other
words, On Error statements have no effect after an ADO error) ; that is
clearly not the case here because no ADO errors have occured and the ADO
Connection Errors collection is empty ; having written literally 100s of
thousands of lines of VBA code over well more than a decade, i've never seen
this before ; i've recompiled and Compressed and Repaired and rebuilt the
code module, all with no effect ; anyone out there have a clue ?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
S

scott w t

Thanks. I'm going to try some Access and VB newsgroups. And, for your
information, here's the troublesome code, which appears at the end of a
procedure that contains about 40 lines of proprietary code:

Dim lng_Test as long
On Error Resume Next
lng_Test = 1 / 0 (this is a test that reproduces the problem with the
proprietary real code)

I've worked around this problem by moving the problem code into its own
procedure and calling that new procedure from the point at which the problem
was occuring in the original procedure. Still, I find it a bit unnerving, so
I am going to continue trying to get to the bottom of this.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top