如何禁用表单中的某些字段 [英] How to disable certain fields in a form

查看:150
本文介绍了如何禁用表单中的某些字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tblExpDetails 有各种字段,包括两个是/否字段和一个类别字段。 frmExpDetails 基于此表。


我想在最终用户使用 frmExpDetails 添加数据时添加一些限制:


1.一次限制选中一个复选框。即,如果选择了一个复选框,则最终用户将无法检查另一个复选框。如果他/她改变主意,她可以编辑他/她的选择,但只能选择一个复选框。


2.根据选定的类别,启用某些字段。例如,如果选择工资单,则可以选择工资单。作为类别,启用了 PayrollDate PayrollNo PayAmount 等字段。其他字段,例如 InvoiceNo " GrossAmount" 已停用。


可以吗?非常感谢您的帮助。


谢谢。

tblExpDetails has various fields including two Yes/No fields and one Category field. frmExpDetails is based on this table.

I would like to add some restrictions wWhen an end user is using frmExpDetails to add data:

1. Restrict selection of one check box at a time. i.e., if one check box is selected the end user will not be able to check the other. If he/she changes her mind she could edit his/her selection but only one check box can be selected.

2. Based on a category selected, certain fields are enabled. For example, if one selects "Payroll" as a category, fields such as, PayrollDate, PayrollNo and PayAmount are enabled. Other fields such as "InvoiceNo" "GrossAmount" are disabled.

Can it be done? Your assistance is much appreciated.

Thanks.

推荐答案

绝对可以做到这一点。

1.关于复选框,您可能想要检查更新后复选框的启用/禁用。事件。

if语句可以用来确定一个的状态,并禁用另一个。


2.更新类别字段后,您可以启用某些字段并禁用其他字段,只需在更新后检查字段的值。

但我建议实际设置可用于显示的字段,以及不能显示的字段,不可见这样你就可以节省空间,并且你不会提供比用户更多的字段。


如果您有任何疑问,请告诉我。


-AJ
This can definitely be done.

1. In regards to the check box, you would probably want to check the enabling/disabling of the check boxes on the "After Update" event.
An if statement can be used to determine the status of one, and disable the other.

2.After the update of the category field, you can enable certain fields and disable others, just do a check on the value of the field after update.
But I would recommend actually setting the fields that can be used to visible, and those which cannot, to not visible. This way you save room, and you don''t offer more fields than the user needs.

Let me know if you have any question.

-AJ


而不是复选框为什么不使用选项按钮,因为这是选项按钮的功能。这样你就不必愚弄代码来启用和禁用等等。


欢呼,

@MNNovice
Instead of check boxes why don''t you use the option buttons since that is the function of option buttons. That way you do not have to fool around with code for enabling and disabling, etc.

cheers,

@MNNovice


@mshmyob


好​​看,应该看到了。我同意。


-AJ
@mshmyob
Nice catch, should have seen that. I concur.

-AJ


这篇关于如何禁用表单中的某些字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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