S
smk23
In my code, I check to see if I have a valid ADODB connection with this code:
Dim cnn As ADODB.Connection
If cnn.State <> adStateOpen Then
Set cnn = New ADODB.Connection
cnn.Open fstrADODBConnectionString()
End If
I am getting an error "object variable not set" on the first line of the
"if" statement. The fstrADODBConnectionString is fine. I use it numerous
places. Is it complaining because it doesn't know what cnn is? This line
should be checking to see if the connection is open and open it if not. What
am I missing?
Dim cnn As ADODB.Connection
If cnn.State <> adStateOpen Then
Set cnn = New ADODB.Connection
cnn.Open fstrADODBConnectionString()
End If
I am getting an error "object variable not set" on the first line of the
"if" statement. The fstrADODBConnectionString is fine. I use it numerous
places. Is it complaining because it doesn't know what cnn is? This line
should be checking to see if the connection is open and open it if not. What
am I missing?