I am trying to create a conditional to check if an ADODB connection is open or not before I call .UpdateBatch/.CancelBatch and then .Close. After calling objDBConn.Close, I have
Set objDBConn = Nothing
I thought I could then just test if objDBConn = Nothing, but if objDBConn is actually 'Nothing' and I have the code
If objDBConn <> Nothing Then
I get the error Microsoft VBScript runtime error: Object variable not set or Type mismatch
I tried checking its VarType() but that always returns vbObject, even if it's Nothing. How do I test properly to see if it's still open? |