Hale, Jim
jim.hale at fleetpride.com
Mon Jul 7 16:03:03 CDT 2003
Instead of using on error I use this format in the exit section: If Not (rstLookup Is Nothing) Then rstLookup.Close: Set rstLookup = Nothing Jim Hale -----Original Message----- From: Steven W. Erbach [mailto:serbach at new.rr.com] Sent: Monday, July 07, 2003 10: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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030707/04da9b3c/attachment-0001.html>