I've been looking for a way to know if a ADO recordset is open. I find this where I met the syntax:
If Not (rs Is Nothing) Then
If (rs.State And 1) = 1 Then rs.Close
Set rs = Nothing
End If
I read explanation posted by @Raybarg however I have the following question: Syntax:
If Not (rs Is Nothing) Then
If rs.State > 0 Then rs.Close
Set rs = Nothing
End If
is not equivalent? There may be a case where Recordset exists but .State
property returns something other than an ObjectStateEnum value?
Thanks!