使用 Oracle 的 ODBC 链接表登录 Access 2007
我正在将Access 2003迁移到2007。有很多来自Oracle的链接表。我创建一个指向 Oracle 实例的 ODBC,然后在 Access 中通过 ODBC 链接所有表。我使用此代码登录,因此不会弹出“Oracle ODBC Driver Connect”对话框询问密码:
strConnect = "ODBC;DATABASE=" & strFCPD & ";DSN=PBRIS;UID=xxxxx;PWD=xxxxx"
Dim wsp As Workspace
Set wsp = DBEngine.CreateWorkspace("xxx", "xxx", "xxx", dbUseODBC)
Set dbs = OpenDatabase("", False, True, strConnect) ' connect via regular ODBC
dbs.Close
它在 2003 年工作正常,但在 2007 年不行。这里出了什么问题?我应该怎么办?
I'm migration Access 2003 to 2007. There are a lot of linked table from Oracle. I create a ODBC point to Oracle instance, then in Access I link all table through ODBC. I use this code login, so the "Oracle ODBC Driver Connect" dialog box would not popup to ask password:
strConnect = "ODBC;DATABASE=" & strFCPD & ";DSN=PBRIS;UID=xxxxx;PWD=xxxxx"
Dim wsp As Workspace
Set wsp = DBEngine.CreateWorkspace("xxx", "xxx", "xxx", dbUseODBC)
Set dbs = OpenDatabase("", False, True, strConnect) ' connect via regular ODBC
dbs.Close
It works fine in 2003 but not in 2007. What's wrong here? What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Access 2007 使用与 Access 2003 不同的 ODBC 驱动程序吗?如果是这样,您需要创建一个使用 Access 2007 驱动程序的新 DSN。看起来现有的 DSN 名为“PBRIS”。进入 ODBC 管理器并使用管理工具的“系统 DSN”选项卡创建一个新的 DSN,并指定 Access 2007 驱动程序而不是 Access 2003 驱动程序。您可能想要以不同的方式命名它 - 也许类似于“PBRIS2007”。您需要更改构建连接字符串的代码以指定新的数据源名称。
我希望这有帮助。
Does Access 2007 use a different ODBC driver than Access 2003? If so you'll need to create a new DSN which uses the Access 2007 driver. It looks like the existing DSN is named "PBRIS". Go into the ODBC Administrator and create a new DSN using the System DSN tab of the administrator tool, and specify the Access 2007 driver instead of the Access 2003 driver. You'll probably want to name it differently - perhaps something like "PBRIS2007". You'll need to change your code which builds the connect string to specify the new data source name.
I hope this helps.