在表单中构建必需的字段逻辑和相应的错误消息 [英] building required field logic in a form and corresponding error messages

查看:30
本文介绍了在表单中构建必需的字段逻辑和相应的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在构建一个表单,我希望它有条件错误消息。


例如,我是创建日期字段。如果填充了日期字段,我还需要填充字段2并创建错误消息。但是,如果未填充日期字段,则无需填充字段2.


这可能吗?

解决方案

您可以使用具有未绑定控件的表单以及保存或提交按钮。单击时,您可以执行所需的任何验证代码,如果一切都有效,则插入记录。无论如何,这是我对具有大量验证的表单的偏好。如果您决定走这条路并遇到问题,请告诉我。


Hi Chip,


感谢您的回复!这是我遇到问题的地方。我不知道在哪里放逻辑。我希望构建的逻辑是这样的:


Expr1:IIf([注册日期]不为空且[count]为空,{REJECT RECORD AND DISPLAY ERROR消息计数要求},{接受记录}}


我希望设计表格,以便大写和包含在{}中。这有意义吗?


快速简便的方法是Form'的BeforeUpdate事件中的一些代码。

展开 | 选择 | Wrap | 行号< /跨度>

Hi,

I am building a form and i would like it to have conditional error messages.

For instance, I am creating a Date field. If the date field is populated, I also need Field 2 populated and an error message created. However, if the date field is not populated, then Field 2 need not be populated.

is this possible?

解决方案

You could use a form with unbound controls and a Save or Submit button. On click, you can execute whatever validation code you want, then if everything is valid, insert a record. That''s my preference for forms with lots of validation, anyway. Let me know if you decide to go this route and have problems.


Hi Chip,

thanks for responding! Here''s where i have problems. i''m not sure where to put the logic. the logic i''m hoping to build is something like this:

Expr1: IIf([ENROLLMENT DATE] Is Not Null And [count] Is Null, {REJECT RECORD AND DISPLAY ERROR MESSAGE COUNT REQUIRED},{ACCEPT THE RECORD})

I''m hoping to design the form so that the capitalized and encased in {} is the outcome. does this make sense?


A quick and easy way is some code in the Form''s BeforeUpdate event.

Expand|Select|Wrap|Line Numbers


这篇关于在表单中构建必需的字段逻辑和相应的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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