在 Access 2007 中链接 ODBC 表
我有一个 Access 2002 应用程序,它通过 ODBC 使用以下代码链接 Oracle 表:
Set HRSWsp = CreateWorkspace("CONNODBC", "", "", dbUseODBC)
Set HRSConn = HRSWsp.OpenConnection("HRSCONN", dbDriverPrompt, , "ODBC;")
DoCmd.TransferDatabase acLink, "Database ODBC", HRSConn.Connect, acTable, "SCHEMA.TABLE", "TABLE", False, True
不幸的是,Access 2007 不再接受此语法,表示不再支持 ODBCDirect(运行时错误 3847)并建议使用 ADO 而不是 DAO。 有人可以告诉我如何修改此代码以满足 Access 2007 的要求吗?
I have an Access 2002 application which links an Oracle table via ODBC with this code:
Set HRSWsp = CreateWorkspace("CONNODBC", "", "", dbUseODBC)
Set HRSConn = HRSWsp.OpenConnection("HRSCONN", dbDriverPrompt, , "ODBC;")
DoCmd.TransferDatabase acLink, "Database ODBC", HRSConn.Connect, acTable, "SCHEMA.TABLE", "TABLE", False, True
Unfortunately, Access 2007 doesn't accept this syntax anymore, saying that ODBCDirect is no more supported (Runtime error 3847) and suggesting to use ADO instead of DAO.
Could someone please tell me how can I modify this code to satisfy Access 2007?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现我可以用一种非常简单的方式解决我的问题,通过删除前两个语句并以这种方式修改第三个语句:
这样表将被链接而不会提示任何内容。 如果我将连接字符串保留为简单的“ODBC”,Access 将要求指定 odbc 连接和其他缺少的参数,从而获得我尝试使用前面的语句执行的相同操作。
I found that I could solve my problem in a very simple way, by deleting the first two statements and modifying the third this way:
This way the table would be linked without prompting for anything. If I leave the connect string a simple "ODBC", instead, Access will ask to specify the odbc connection and the other missing parameters, thus obtaining the same thing I tried to perform with the previous statements.
尝试以下操作:
将括号 (
[]
) 中的文本替换为您的信息。Try this:
Replace text in brackets (
[]
) with your info.