MS Access - 使用 "Filter by Form" 时更改表单的外观

MS Access - Change appearance of form when using "Filter by Form"

我为我的团队创建了一个前端和后端数据库 MS Access 解决方案(我仅限于 MS Access 2013),使用表单进行数据输入、查找和编辑。它运行良好,但有时用户会忘记他们在 "Filter by form" 中,并在过滤器而不是实际表单中输入数据。当他们意识到自己的错误时,他们必须重新输入所有数据。

是否可以在 "Filter by Form" 中更改表单的外观?例如,更改背景颜色,或添加文本框通知,以便用户非常明显地知道他们在 "Filter by Form"?

您可以使用 Me.FilterOn 属性 来帮助确定表单过滤器(即 HomeAdvancedFilter By Form )是否打开.

您可能需要稍微尝试一下,但根据我的实验,您可以在 OnOpen 事件中使用一些东西来检查 属性 并采取适当的行动。

我认为问题在于代码在过滤器模式下不会执行,因此,您必须将默认外观设置为 "Filter appearance"(也许添加一个图形或文本框,上面写着 "Filter Mode"),然后如果 Me.FilterOn = False 您可以在 OnOpen 事件中隐藏该标签。

Also:

The Apply Filter button indicates the state of the Filter and FilterOn properties. The button remains disabled until there is a filter to apply. If an existing filter is currently applied, the Apply Filter button appears pressed in.

To apply a filter automatically when a form or report is opened, specify in the OnOpen event property setting of the form either a macro that uses the ApplyFilter action or an event procedure that uses the ApplyFilter method of the DoCmd object.
(Source)


更多信息: