[AccessD] A2K: On error goto next

Jim Dettman jimdettman at earthlink.net
Mon Jul 7 10:08:11 CDT 2003


Steve,

  Try changing that to:

  On Error Resume Next

  Not goto.  I think Access is getting confused and actually looking for a
label called "next".  I'm surprised that you didn't get a compile error.

Jim Dettman
President,
Online Computer Services of WNY, Inc.
(315) 699-3443
jimdettman at earthlink.net

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Steven W.
Erbach
Sent: Monday, July 07, 2003 11:05 AM
To: AccessD at databaseadvisors.com
Subject: [AccessD] A2K: On error goto next


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


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list