如何要求用户从组合框中选择值? [英] How to require user to select value from combo box?

查看:209
本文介绍了如何要求用户从组合框中选择值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MS2007 - 我有2个组合框,''cboDivisions''& cboGroups。用户从''cboDivisions'中选择分区,但不是所有分区都有相关的组。如果所选分区没有组,则设置cboGroups不可见属性。我遇到的问题是,当有一些存在时,我的用户并不总是为某个部门选择一个组。我想强迫他们在Divsion拥有他们时选择一个团体。我在Form_BeforeUpdate事件中放了一些代码。 cbo_group.value的测试工作,并显示msbbox

这是我正在使用的代码:

MS2007 - I have 2 combo boxes, ''cboDivisions'' & ''cboGroups''. User selects the division from ''cboDivisions'' but not all Divisions have groups associated. If there are no groups for the selected division, I set cboGroups invisible property. The problem I am having is my users are not always selecting a Group for a Division when there are some present. I want to force them to select a Group when the Divsion had them. I have put some code in the Form_BeforeUpdate event. The test for cbo_group.value works and the msbbox is displayed
Here is the code I am using:

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

推荐答案

您可以在表单上使用before update事件来检查cbo_group是否为null,如果为null则取消。您可能需要进行另一个If / Then / Else检查以查看cbo_group是否应该有值。您可能能够检查它是否可见,如果是,则运行检查以查看它是否为空。
You could use a before update event on the form to check if cbo_group is null and cancel if it is null. You would probably have to come up with another If/Then/Else check to see if cbo_group is supposed to have a value. You might be able to check if it is visible and if it is, then run the check to see if it is null.


根据表中的要求设置字段。
Set the field as required in the table.


Seth,我确实把代码放在表单上的更新前事件中,然后检查是否为null。我确实有一个if / then / else测试,看看该部门是否有围绕我上面代码的组。我如何取消?哈文以前没用过这个。我一直使用''exit sub''。
Seth, I did put the code in the before update event on the form and I check to see if null. I do have an if/then/else test to see if the division has groups wrapped around the code I have above. How do I ''cancel''? Haven''t used this before. I have always used ''exit sub''.


这篇关于如何要求用户从组合框中选择值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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