Created a small application the uses linked SQL Server tables which were set up manually. I would like to create the link using VBA so I can transport the application to PC's that don't have MS Office 10 on them. The application iscreated in Office 10 and the tables are in SQL Server Express 8. I have tried executing the following bit of code with no success, although it compiles:
DoCmd.TransferDatabase acLink, "ODBC Database", _
"ODBC;Driver={SQL Server};Server=ServerNme;Database=DbNme;" & _
"Uid=nn;Pwd=xxxxxx",acTable,"MYSQLTABLE","MYACC ESSTABLE"
I get this error:
Connection failed:
SQLState:01S00
SQLServer Error:0
[Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
Connection failed:
SQLState:’0100’
SQL Server Error:53
[Microsoft][ODBC SQL Server Driver][DBNETLIB]Connection open
(connect()
Connection failed:
SQL Server Error:17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or is denied.
After reading the web a lot, I tried using SQL Native Client as:
DoCmd.TransferDatabase acLink, "ODBC Database", _
"ODBC;Driver={SQL Native Client};Server=ServerNme;Database=DbNme;" & _
"Uid=nn;Pwd=xxxxxx",acTable,"MYSQLTABLE","MYACC ESSTABLE"
Then I get 'ODBC--connection to {SQL Native Client} John-PC failed
and "Error 3151". for which there are many description on the web
As stated, all I want to do is create a link to two tables in an SQL Server database in vba.
Any help would be appreciated.
Thanks.
jpl
DoCmd.TransferDatabase acLink, "ODBC Database", _
"ODBC;Driver={SQL Server};Server=ServerNme;Database=DbNme;" & _
"Uid=nn;Pwd=xxxxxx",acTable,"MYSQLTABLE","MYACC ESSTABLE"
I get this error:
Connection failed:
SQLState:01S00
SQLServer Error:0
[Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
Connection failed:
SQLState:’0100’
SQL Server Error:53
[Microsoft][ODBC SQL Server Driver][DBNETLIB]Connection open
(connect()
Connection failed:
SQL Server Error:17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or is denied.
After reading the web a lot, I tried using SQL Native Client as:
DoCmd.TransferDatabase acLink, "ODBC Database", _
"ODBC;Driver={SQL Native Client};Server=ServerNme;Database=DbNme;" & _
"Uid=nn;Pwd=xxxxxx",acTable,"MYSQLTABLE","MYACC ESSTABLE"
Then I get 'ODBC--connection to {SQL Native Client} John-PC failed
and "Error 3151". for which there are many description on the web
As stated, all I want to do is create a link to two tables in an SQL Server database in vba.
Any help would be appreciated.
Thanks.
jpl