Any idea why this doesn't work?
The rsRes.Close statement still returns an error if it is already closed.
VB Code:
handleError: 'In case error occurs while connection and/or recordset closed On Error Resume Next rsRes.Close cnnCon.Close
Printable View
Any idea why this doesn't work?
The rsRes.Close statement still returns an error if it is already closed.
VB Code:
handleError: 'In case error occurs while connection and/or recordset closed On Error Resume Next rsRes.Close cnnCon.Close
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???
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.Quote:
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'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.:D
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.