表验证规则和表单冲突 [英] Table validation rule and form conflicting

查看:51
本文介绍了表验证规则和表单冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。


我创建了一个数据库,其中包含一个附有每个字段的验证规则的表,以防止错误数据。例如,forename必须包含在表中,所以我使用了Is Not Null验证规则。


我还有一个用于数据输入表格的表格,工作正常。将数据输入表单并单击添加新记录按钮时,我的自定义消息也会按预期显示。但是,如果用户然后进入某个字段删除他们所写的内容然后尝试离开该字段,则会陷入各种各样的循环中。


示例:" ;约翰"输入Forename字段,然后用户点击添加新记录,出现消息框说错误并非所有字段都已完成,然后用户返回并删除John。从Forename字段中尝试单击关闭,出现消息框,说明表的验证文本,用户无法移动,直到输入字段为止。


我知道这是一个可以通过不删除字段中的文本而只是移出表单来避免的小细节但是知道它现在存在是令人讨厌的。


任何帮助都将非常感激!

Hi there.

I have made a database which has a table with validation rules attached to each of the fields in order to prevent "bad data". For example the forename must be included in the table so I have used a Is Not Null validation rule.

I also have a form used for data entry into the table which works fine. When data is entered into the form and the add new records button is clicked, my custom message also appears as intended. However, if the user then goes into a field as deletes what they have written and then tries to move away from the field, they get caught in a loop of sorts.

Example: "John" is entered into Forename field, User then clicks add new record, message box appears saying error not all fields completed, user then goes back and deletes "John" from the Forename field and tries to click off, message box appears stating the validation text of the table and user cannot move away until something is entered into the field.

I know this is a minor detail which can be avoided by not deleting the text from the field and just moving off of the form but it is annoying knowing it now exists.

Any help will be most appreciated!

推荐答案

您必须检查表单是否脏。如果是,则取消任何更新。还有其他方法可以做到这一点,但这可能是最容易和最直接的。
You must check to see if the form is "dirty". If it is, then cancel any updates. There are other ways to do this, but this is perhaps the easiest and most straightforward.


感谢您的快速回复,我将如何检查它是否脏。我是Access和VBA的新手。
Thank you for the quick response, how would I go about checking it it is "dirty". I''m pretty new to Access and VBA.


一般检查将在If ... Then声明中:

The general check would be within an If...Then statement:

展开 | 选择 | Wrap | 行号


这篇关于表验证规则和表单冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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