I am using OnError handler in my VBA code that jumps to
MsgBox ("Error rendering to spreadsheet")
If Not rc Is Nothing Then
Set rc = Nothing
The problem is that if the error is triggered when opening a recordset, it cannot execute
and shows an error: "Operation is not allowed when the object is closed"
How can I fix this? i could add On Eror Resume Next before rc.close, but would rather try to identify a case when recordset object is created but not opened.