I'm trying to connect to Go Daddy's SQL Server database using the following test connection string inside Excel, but I keep getting 'Run-time error '-2147217843 (80040e4d)' Invalid connection string attribute.'
What is wrong with this VBA code?
Any help would be appreciated. I've been searching online and looking for answers for some time now.
What is wrong with this VBA code?
Code:
Dim cnn As ADODB.Connection
Dim canConnect As Boolean
Public Sub TestConnection()
Set cnn = New ADODB.Connection
cnn.Open "Provider=sqloledb;Data Source=testdb.com;Initial Catalog=DBw; UserID=userID; Password='Password';"
If cnn.State = adStateOpen Then
canConnect = True
cnn.Close
End If
MsgBox canConnect
End Sub
Comment