SQL Server connection string

jsic1210

Registered User.
Local time
Today, 12:11
Joined
Feb 29, 2012
Messages
188
Hi,

I'm trying to create a connection to SQL Server 2012 upon opening my FE Access DB. I put the code in my VBA upon loading my main form. My error message is "Invalid connection string attribute." My code is:
Code:
Dim strCon As String
Dim cn As ADODB.Connection

' create connection
Set cn = New ADODB.Connection
strCon = "Provider=SQLNCLI11; " & _
    "DSN= Jeff - Data Source; " & _
    "Database = ybFinance; " & _
    "UID=UserName; " & _
    "PWD=MyPassword;"

' open connection
cn.Open strCon
 

Users who are viewing this thread

Back
Top Bottom