mikemcginty
Programmer
What is the best method to handle ADO recordset errors to ensure propper cleanup while leaving the active connection open?
The following code gives an error 3219 "Operation is not allowed in this context" if I put the Done before closing the recordset. Does this mean the recordset is already closed by the error?
If I set the recordset to Nothing, does this automatically close the recordset first (ie is .close necessary)?
Thanks
Mike
Dim rsRecordset as New ADODB.Recordset
On error Goto TrapError
Set rsRecordset = activeconnection
.source = "select...."
.open
code
rsRecordset.close
Done:
set rsRecordset = Nothing
Exit Sub
TrapError:
on error goto Done
resume next
End Sub
When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!
The following code gives an error 3219 "Operation is not allowed in this context" if I put the Done before closing the recordset. Does this mean the recordset is already closed by the error?
If I set the recordset to Nothing, does this automatically close the recordset first (ie is .close necessary)?
Thanks
Mike
Dim rsRecordset as New ADODB.Recordset
On error Goto TrapError
Set rsRecordset = activeconnection
.source = "select...."
.open
code
rsRecordset.close
Done:
set rsRecordset = Nothing
Exit Sub
TrapError:
on error goto Done
resume next
End Sub
When you call out for help in the darkness, and you hear a voice in return, you're probably just talking to yourself again!