1

在 MS-Access 中,我知道参照完整性规则,例如级联更新和删除以及使用 DDL 创建它们。

但是在表已经创建之后,如何再次列出这些表呢?

4

1 回答 1

3

在 VBA 中,您可以使用 TableDefs 和关系集合来显示表和关系属性。您还可以使用 ADO 模式来获取信息。

特别是,您将希望引用关系的属性:

Name                    Value       Description
dbRelationDeleteCascade 4096        Deletions cascade
dbRelationDontEnforce   2           Relationship not enforced (no referential integrity)
dbRelationInherited     4           Relationship exists in the database containing the two linked tables
dbRelationLeft          16777216    Microsoft Access only. In Design view, display a LEFT JOIN as the default join type.
dbRelationRight         33554432    Microsoft Access only. In Design view, display a RIGHT JOIN as the default join type.
dbRelationUnique        1           One-to-one relationship
dbRelationUpdateCascade 256         Updates cascade

http://msdn.microsoft.com/en-us/library/bb225809.aspx

Dim rel As Relation
Dim tdf As TableDef

For Each rel In CurrentDb.Relations
    Debug.Print rel.Attributes
Next

4352 = dbRelationUpdateCascade + dbRelationDeleteCascade

于 2012-10-22T14:54:18.340 回答