ADODB Object
 
Syntax
 
long = connectionobject.State
 
Description
Returns a long value (the ObjectStateEnum value) describing if the connection is open or closed.
The State property returns a long value that is the sum of one or more ObjectStateEnum constants. These constants describe if the Connection object is open, closed, or connecting.
 
The adStateExecuting and adStateFetching constants are not used. The default value is adStateClosed.
 
You can call the State property at any time.
 
ObjectStateEnum Constants 
 
Constant
Value
Description
adStateClosed
0
Object is closed
adStateOpen
1
Object is open
adStateConnecting
2
Attempting to connect
adStateExecuting
 
Not used
adStateFetching
 
Not used
See Also
Command.State, Record.State, Recordset.State, Stream.State.
Example
 
If (objConnection.State = adStateClosed) Then
   Debug.Print "Connection object is closed"
End If