Connection String Between MS Access 2016 and SQL Server 2012 to call stored procedure with parameters using a command object in VBA?
At work, I have a couple of Access Project programs developed in MS Access 2000 as .ade/.adp formats, and they are still usable in our current MS Access 2007 and SQL Server 2012 environment. With our move to MS Access 2016, I began to convert one of them to just be the "regular" .accdb format.
I began with creating an ODBC connection (System DSN), and then, I found out that in order to call in VBA my stored procedure with parameters via an ADODB command object, I had to have a second connection to SQL Server. I looked on the Internet and after several trials, I used this connection string and it worked in my test environment of MS Access 2007 and SQL Server 2016:
"Provider=MSOLEDBSQL;Server=OurSQLinstance;Database=OurDBname;Integrated Security=SSPI;"
Then, in order to limit the changes that I have to make, I reduced the scope to just remaining on SQL Server 2012 but also tried using MS Access 2016. The above connection string does not work in that environment combo, so I have been looking on the Internet for the format that will work. I know it would benefit me to read up and learn how to use connections and connection strings but due to deadline pressures and limited time, I am putting this out to see if there is a connection string format that would magically work for our environment combination (MS Access 2016 and SQL Server 2012).
If there is a link to an Internet resource related to ADODB connection strings for matrix combinations of SQL Server and Access version that anybody on the forum can provide, I would be grateful for that, too.
Thank you.
At work, I have a couple of Access Project programs developed in MS Access 2000 as .ade/.adp formats, and they are still usable in our current MS Access 2007 and SQL Server 2012 environment. With our move to MS Access 2016, I began to convert one of them to just be the "regular" .accdb format.
I began with creating an ODBC connection (System DSN), and then, I found out that in order to call in VBA my stored procedure with parameters via an ADODB command object, I had to have a second connection to SQL Server. I looked on the Internet and after several trials, I used this connection string and it worked in my test environment of MS Access 2007 and SQL Server 2016:
"Provider=MSOLEDBSQL;Server=OurSQLinstance;Database=OurDBname;Integrated Security=SSPI;"
Then, in order to limit the changes that I have to make, I reduced the scope to just remaining on SQL Server 2012 but also tried using MS Access 2016. The above connection string does not work in that environment combo, so I have been looking on the Internet for the format that will work. I know it would benefit me to read up and learn how to use connections and connection strings but due to deadline pressures and limited time, I am putting this out to see if there is a connection string format that would magically work for our environment combination (MS Access 2016 and SQL Server 2012).
If there is a link to an Internet resource related to ADODB connection strings for matrix combinations of SQL Server and Access version that anybody on the forum can provide, I would be grateful for that, too.
Thank you.
Last edited: