[AccessD] A2K: On error goto next

Steven W. Erbach serbach at new.rr.com
Mon Jul 7 10:05:09 CDT 2003


Dear Group,

I've used the D-Function replacements created by T. Best for some time. I
have an A2K application that has been churning along for a couple of years
using these functions with nary a quiver.

Today, however, when I wanted to capture some screen shots, I went to run
the application and it debugged at the first use of one of those D-Function
replacements. Here's the pertinent section of code:

Function tCount(.....)
    ...(Dim statements and code for the body of the function)
    rstLookup.Close
    tCount = lngCount

tCountExit:
    On Error Goto Next
    rstLookup.Close
    Exit Function
tCountError:
    msgBox ...
    Resume tCountExit

As you can see, just before the tCountExit subroutine the function closes a
RecordSet and sets the value of the function to a Long Integer value
calculated in the body of the function. The tCountExit subroutine tries to
be neat and tidy about cleaning up the rstLookup RecordSet object variable
just in case there's been an error in the body of the function.

Here's the problem: the tCount fuction closes the rstLookup object and does
its thing properly by assigning a Long Integer value to the tCount function.
Code execution drops into the tCountExit subroutine just as it should...but
the app debugs at the rstLookup.Close instruction right after the On Error
Goto Next. It's as if Access doesn't even "see" the Goto Next.

I've decompiled the application but the same error occurs. I finally
commented out the rstLookup.Close in the tCountExit subroutine and
everything flies just fine...but this code has been running without a hitch
for two years or so. Any ideas? It beats my pair of Jacks.

Regards,

Steve Erbach
Scientific Marketing
Neenah, WI




More information about the AccessD mailing list