Results 1 to 5 of 5

Thread: 'On Error Resume Next' doesn't

  1. #1

    Thread Starter
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    'On Error Resume Next' doesn't

    Any idea why this doesn't work?
    The rsRes.Close statement still returns an error if it is already closed.
    VB Code:
    1. handleError:
    2.    
    3.     'In case error occurs while connection and/or recordset closed
    4.     On Error Resume Next
    5.    
    6.     rsRes.Close
    7.     cnnCon.Close

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    have to tried stepping through it to make sure it definatly errors on that line??

    not on another line or an event causes by closing the recordset or anything???
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    well why do you have

    On Error Resume Next

    inside your error handle.. shouldn't that go at the top of your sub/function?

    also you can use

    rsRes.State to determine the open/closed state of a recordset or connection (cnnCon.State)... it will return either a 0 or 1 for closed or open.

  4. #4

    Thread Starter
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479
    Originally posted by kleinma
    well why do you have

    On Error Resume Next

    inside your error handle.. shouldn't that go at the top of your sub/function?

    also you can use

    rsRes.State to determine the open/closed state of a recordset or connection (cnnCon.State)... it will return either a 0 or 1 for closed or open.
    I only want to resume on an error within the error handler.
    I'll sort (hopefully) all errors within it.
    but now, thanks to you I know how to check if the rs is open, so I'll not need it.
    Cheers.

  5. #5
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843
    you might try clearing the error (err.clear)
    so that it pays attention to the close error, otherwise
    I've noticed erroring in an error handler crashes out of the
    sub and hits any outside error handlers.

    but I'd guess checking the state is a better solution.
    Merry Christmas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width