This code stopped working after I got a new machine.
I've checked the references and don't have any missing.
I keep getting the error:
Run-time error '-2147467259(800004005)':
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.
Any suggestions of what could be wrong ?
TIA for all assistance,
Beth
-------------------------------------------------------
Global cnn1 As ADODB.Connection
Public Sub TestConnection(cnn1)
Dim strDataSource As String
Dim strInitialCatalog As String
strDataSource = "DATA_01"
strInitialCatalog = "DATA_01"
Set cnn1 = New ADODB.Connection
With cnn1
cnn1.Provider = "SQLOLEDB.1"
.ConnectionString = "User ID=;Password=;" & _
"Data Source=" & strDataSource & ";" & _
"Initial Catalog=" & strInitialCatalog & ";"
.ConnectionTimeout = 25
.Open
End With
End Sub
I've checked the references and don't have any missing.
I keep getting the error:
Run-time error '-2147467259(800004005)':
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access denied.
Any suggestions of what could be wrong ?
TIA for all assistance,
Beth
-------------------------------------------------------
Global cnn1 As ADODB.Connection
Public Sub TestConnection(cnn1)
Dim strDataSource As String
Dim strInitialCatalog As String
strDataSource = "DATA_01"
strInitialCatalog = "DATA_01"
Set cnn1 = New ADODB.Connection
With cnn1
cnn1.Provider = "SQLOLEDB.1"
.ConnectionString = "User ID=;Password=;" & _
"Data Source=" & strDataSource & ";" & _
"Initial Catalog=" & strInitialCatalog & ";"
.ConnectionTimeout = 25
.Open
End With
End Sub