cipriano555
asked on
VBA with ADO: How can you set the Provider property of a connection in Access 2013
I am trying to set the value of the connection string property. My data is not in Access, it is in SQL Server, I'm just using Access to develop a front end.
I have been following a text book, but when I follow their example, it does not work. I created a button, and an afterclick event handler for it. See below, it is the assignment statement for sConn that doesn't work.
Private Sub Command3_Click()
Dim adConn As ADODB.Connection
Dim sConn As String
Set adCon = New ADODB.Connection
sConn = "Provider=SQLOLEDB.1;Integ rated Security=SSPI;Persist Security Info=False; Initial Catalog=DATA_CONCEPTS;Data Source=SRVR7LF\MSSQL2012"
adConn.ConnectionString = sConn
adConn.Open
MsgBox (adConn.Provider)
adConn.Close
Set adConn = Nothing
End Sub
ADO-ERROR-1.JPG
ADO-ERROR-2.JPG
I have been following a text book, but when I follow their example, it does not work. I created a button, and an afterclick event handler for it. See below, it is the assignment statement for sConn that doesn't work.
Private Sub Command3_Click()
Dim adConn As ADODB.Connection
Dim sConn As String
Set adCon = New ADODB.Connection
sConn = "Provider=SQLOLEDB.1;Integ
adConn.ConnectionString = sConn
adConn.Open
MsgBox (adConn.Provider)
adConn.Close
Set adConn = Nothing
End Sub
ADO-ERROR-1.JPG
ADO-ERROR-2.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER