通过odbc驱动程序链接访问表 [英] Link access table via odbc driver
问题描述
我需要链接到一个Access格式的文件(它可以通过Access打开),但它有另一种文件类型 - .dvprj而不是.mdb或.accdb。文件名需要保留.dvprj,因此它将在其应用程序中打开。
访问只会在链接到Access外部数据时识别.mdb或.accdb数据库>新数据源>来自数据库>访问。
我尝试过:
我设置了一个ODBC数据源具有用户DSN和文件DSN,但是当我尝试使用外部数据链接来自Access的表时>新数据源>其他来源> ODBC数据库,使用任一方法,我收到以下错误消息:
您不能使用ODBC从外部Microsoft Jet或ISAM导入,导出或链接数据库表到你的数据库。(错误3423)
有什么想法吗?
I need to link to a file which is in Access format (it can be opened by Access), but it has another file type - .dvprj instead of .mdb or .accdb. The file name needs to stay .dvprj so it will open in its application.
Access will only recognize .mdb or .accdb databases when linking to Access External Data > New Data Source > From Database > Access.
What I have tried:
I set up an ODBC Data source with a User DSN and as a File DSN, but when I try to link a table from Access using External Data > New Data Source > Other Sources > ODBC Database, using either method, I get the following error message:
"You cannot use ODBC to import from, export to, or link an external Microsoft Jet or ISAM database table to your database. (Error 3423)"
Any ideas?
推荐答案
第一个链接复制该文件,重命名为accdb(或mdb)。
然后运行代码重新链接到原始文件:
First link a copy of the file, renamed as accdb (or mdb).
Then run code to relink to the table(s) from the original file:
Public Function Relink()
Dim Database As DAO.Database
Dim Table As DAO.TableDef
Dim Connect As String
Set Database = CurrentDb
Set Table = Database.TableDefs("SomeTable")
Connect = Table.Connect
Debug.Print Connect
Connect = Replace(Connect, ".accdb", ".dvprj")
Debug.Print Connect
Table.Connect = Connect
Table.RefreshLink
Debug.Print Table.Connect
End Function
这是一个很好的解决方案。
我会向前推进尝试。
谢谢,汤姆
This is a great solution.
I will give it a try as I move forward.
Thanks, Tom
这篇关于通过odbc驱动程序链接访问表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!