以编程方式添加到MS Access关系图 [英] Adding to MS Access relationship diagram programmatically

查看:109
本文介绍了以编程方式添加到MS Access关系图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有JET数据库的客户应用程序,其中包括一个关系图,邀请更精明的用户查看该关系图,以深入了解数据库的构建。

I have an application that ships to the customer with a JET database including a relationship diagram which more savvy users are invited to view to gain insight into the construction of the database.

当新版本需要新表,新列或修改后的查询时,我的应用程序中也有代码可以更新数据库结构。我是通过通过ADO连接推动SQL来实现的。它工作正常。

I also have code in my application to update the database structure when new versions require new tables, new columns, or modified queries. I do this by pushing SQL through the ADO connection it works fine.

问题是,如果我添加一个新表,并将其约束与现有表相关联(例如,我将具有FK关系的EmployeeHobbies添加到Employees中的现有PK),而表的构造正确时,新关系不会出现在关系图中。随着时间的推移,该图变得越来越不完整。

The problem is that if I add a new table with a constraint that relates it to an existing table (for instance, I add EmployeeHobbies with an FK relationship to an existing PK in Employees), while the table is constructed correctly the new relationship does not appear in the relationship diagram. Over time the diagram becomes progressively less complete.

是否存在一种编程方法来强制Access从数据库中的约束信息更新其关系图,否则,是关系图存储在某些隐藏的系统对象中,可以直接更新以反映更改吗?

Is there a programmatic method to force Access to update its relationship diagram from constraint information in the database or, failing that, is the relationship diagram stored in some hidden system object that I can update directly to reflect my changes?

编辑:我无法弄清楚我的应用程序是用Delphi编写的,而不是MS Access。拥有MS Access副本的用户可以看到关系图,而其他人则看不到。

推荐答案

我不知道如果RunCommand适合,但要值多少钱?

I do not know if RunCommand will suit, but for what it's worth:

DoCmd.RunCommand acCmdRelationships
DoCmd.RunCommand acCmdShowAllRelationships

这篇关于以编程方式添加到MS Access关系图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆