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:
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