如何使子数据表与窗体的数据表视图一起显示

How to cause Subdatasheet to display with Form's Datasheet view

在我的数据库中有一个基于定义了子数据表的查询的表单。当表单处于数据表视图中时,每条记录都显示加号,可以根据源查询上定义的子数据表将其展开以显示相关记录。换句话说,数据表视图会自动显示子数据表——正如预期和需要的那样,所以我知道它可以像这样工作。

然后我根据与现有工作表单相同的查询创建了一个新表单。但是,新的数据表视图不会显示子数据表...没有加号,什么都没有。接下来我用几个相关的 tables 创建了一个测试数据库,我还确保 tables 定义了一个子数据表。如果我直接打开 tables,我会按预期看到加号和子数据表。但是如果我在那些 tables 上定义一个表单,在数据表模式下查看时它不会显示子数据表。 Access Form 没有单独的设置来定义 Subdatasheet,它只能从其记录源对象(即 table 或查询)继承 Subdatasheet 设置。

有没有办法强制表单(在数据表视图中)显示已在记录源对象上定义的子数据表?为什么新表单的功能可能与原始表单不同,即使它基于相同的查询?

我使用的是 Access 2013 和 2007-2013 文件格式的数据库。

子数据表视图仅在数据表视图中可用。

另外,建议使用子数据表视图只阅读而不编辑,因为可能会导致意外错误。

来自微软:

If you add subdatasheets to your tables, limit the use of these subdatasheets to viewing, and not editing, important business data. If you want to edit data in a table, we recommend that you use forms to edit the data instead of subdatasheets, as data entry errors are more likely to occur in datasheet view if users are not careful to scroll to the correct cell. Also note that adding a subdatasheet to a large table can adversely affect the performance of the table.

Microsoft Office Access automatically creates a subdatasheet when you create a table that matches one of the following criteria:

The table is in a one-to-one relationship.

The table is the "one" side of a one-to-many relationship, where the table's SubdatasheetName property is set to Auto.

A relationship is defined by matching the primary key and the foreign key fields in the related tables.

You can also add a subdatasheet to any table, query, or form in a database. In Datasheet view, a form can display only one subdatasheet at a time.