Access 2010的新增功能。运行时的以下VBA代码不会按预期重置连接字符串。我很确定这曾经奏效。怎么了?
CurrentDb.TableDefs("AccountNumber").Connect = "ODBC;Description=NativeClient;DRIVER=SQL Native Client;SERVER=server1;DATABASE=Expense;Trusted_Connection=Yes"
CurrentDb.TableDefs("AccountNumber").RefreshLink
答案 0 :(得分:0)
我不确定那个连接字符串。您使用的是哪个版本的SQL Server?您可能想尝试http://www.connectionstrings.com/sql-server-2008#p3中的连接字符串,例如,这适用于我。
scn = "Driver={SQL Server Native Client 10.0};" & _
"Server=ServerName; Database=test;Trusted_Connection=yes;"
With CurrentDb
.TableDefs(sLocalName).Connect = scn
.TableDefs(sLocalName).RefreshLink
End with