如何在ms-access VBA中检索表的odbc数据库名称

发布于 2024-07-29 13:06:29 字数 129 浏览 2 评论 0原文

我有一个 ms-access 数据库和几个 ODBC 链接表。

因为我有两套 ODBC 数据库,一套用于生产,另一套用于开发,它们有不同的名称“开发”和“生产”。

如何使用VBA获取链接表的odbc信息?

I have a ms-access database and several ODBC linked tables in it.

As I have 2 set of ODBC database ,one is for production the other is for development, they have different names Development and Production.

How can I get the odbc info of the linked tables by using VBA?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

归途 2024-08-05 13:06:29

使用表的本地名称,您可以在 MSysObjects 系统表(通常是隐藏的)中查询该表的外来名称。

SELECT MSysObjects.ForeignName
FROM MSysObjects
WHERE (((MSysObjects.Name)="LocalTableName"));

如果您需要有关外部表的更多信息,请尝试解析同一个表中的“连接”列。

Using the local name of the table, you can query the MSysObjects system table (typically hidden) for the table's Foreign Name.

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.

装纯掩盖桑 2024-08-05 13:06:29

事实上,您可以使用 ODBC 连接到 .mdb 文件,就好像它是 Access 数据库一样。 链接表将显示在该 ODBC 连接中,并且可以以全 ODBC 速度进行访问。

这样做的好处是您的程序甚至不必知道表是否是链接表。 将所有这些系统管理员级别的详细信息包含在一个地方是很好的。

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.

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.

稀香 2024-08-05 13:06:29

我确定源的常用方法是重命名表,就像重命名本机表一样。 我可以添加后缀或前缀,例如 tblTrombone_DEVtblTrombone_PROD

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文