I have a ms-access database and several ODBC linked tables in it.
我有一个ms-access数据库和几个ODBC链接表。
As I have 2 set of ODBC database ,one is for production the other is for development, they have different names Development and Production.
由于我有2套ODBC数据库,一套用于生产,另一套用于开发,它们有不同的名称开发和生产。
How can I get the odbc info of the linked tables by using VBA?
如何使用VBA获取链接表的odbc信息?
3 个解决方案
#1
Using the local name of the table, you can query the MSysObjects system table (typically hidden) for the table's Foreign Name.
使用表的本地名称,可以查询表的外部名称的MSysObjects系统表(通常是隐藏的)。
SELECT MSysObjects.ForeignName
FROM MSysObjects
WHERE (((MSysObjects.Name)="LocalTableName"));
If you need more information about the foreign table, try your hand at parsing the 'Connect' column from the same table.
如果您需要有关外表的更多信息,请尝试解析同一表中的“连接”列。
#2
In fact, you can use ODBC to connect to the .mdb file as if it were an Access database. The linked tables will show up in that ODBC connection and be accessible at full ODBC speeds.
实际上,您可以使用ODBC连接到.mdb文件,就像它是Access数据库一样。链接表将显示在该ODBC连接中,并可以完全ODBC速度访问。
The nice thing about doing it that way is your program doesn't even have to know if the tables are linked tables or not. It's nice to contain all these sysadmin-level details in a single place.
这样做的好处是你的程序甚至不必知道表是否是链接表。很高兴在一个地方包含所有这些系统管理员级别的详细信息。
#3
My usual method of determining the source is to rename the tables, just like you would a native table. I may add a suffix or prefix such as tblTrombone_DEV
and tblTrombone_PROD
.
我通常的确定源的方法是重命名表,就像使用本机表一样。我可以添加后缀或前缀,如tblTrombone_DEV和tblTrombone_PROD。
#1
Using the local name of the table, you can query the MSysObjects system table (typically hidden) for the table's Foreign Name.
使用表的本地名称,可以查询表的外部名称的MSysObjects系统表(通常是隐藏的)。
SELECT MSysObjects.ForeignName
FROM MSysObjects
WHERE (((MSysObjects.Name)="LocalTableName"));
If you need more information about the foreign table, try your hand at parsing the 'Connect' column from the same table.
如果您需要有关外表的更多信息,请尝试解析同一表中的“连接”列。
#2
In fact, you can use ODBC to connect to the .mdb file as if it were an Access database. The linked tables will show up in that ODBC connection and be accessible at full ODBC speeds.
实际上,您可以使用ODBC连接到.mdb文件,就像它是Access数据库一样。链接表将显示在该ODBC连接中,并可以完全ODBC速度访问。
The nice thing about doing it that way is your program doesn't even have to know if the tables are linked tables or not. It's nice to contain all these sysadmin-level details in a single place.
这样做的好处是你的程序甚至不必知道表是否是链接表。很高兴在一个地方包含所有这些系统管理员级别的详细信息。
#3
My usual method of determining the source is to rename the tables, just like you would a native table. I may add a suffix or prefix such as tblTrombone_DEV
and tblTrombone_PROD
.
我通常的确定源的方法是重命名表,就像使用本机表一样。我可以添加后缀或前缀,如tblTrombone_DEV和tblTrombone_PROD。