尝试在没有必需名称字段的情况下停止表单 [英] Trying to make a form stop without a required name field

查看:76
本文介绍了尝试在没有必需名称字段的情况下停止表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在表单底部有一个按钮,可以将所有信息发送到表格中。发送表的信息没有名字就没用了。按钮已定义,并且所有字段都没有问题地进入表中,但是我需要一个控件,表示无法在没有名称的情况下提交。该按钮设置为On Click程序,但我无法弄清楚如何编写阻止此操作的If / Then语句。到目前为止,它看起来像这样:

I have a button at the bottom of a form that sends all of the information into a table. The information sent the table is useless without a name. The button is defined and all of the fields are going into the table without a problem, but I need to have a control that says it cannot be submitted without a name. The button is set up with an "On Click procedure, but I can''t figure out how to write an If/Then statement that would prevent this. So far it just looks like this:

展开 | 选择 | Wrap | 行号

推荐答案

percman

这似乎是VBA而不是VB ...


您可以在点击事件中检查控件的值。我会在你发布的代码中的第3行插入这个。

你还应该阅读:什么是Null? 这将帮助您编写正确的代码以检查真正的空和零长度条目。
percman
This appears to be VBA and not VB...

You would check the value of the control in the on-click event. I would insert this at line3 in your posted code.
You should also read: What is Null? as this will help you write the proper code to check for both a true null and zero-length entries.


尝试以下操作:
Try the following:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


感谢Adezii!


有一件事有点棘手,上面的代码只是整个字符串的一个示例。在Me.EMPLOYEE.Value之后,有一大堆代码记录了所有7天的其他方面 - 小时,百分比等,然后还有更多代码将整个表单重置为空白。我试图在整个字符串的末尾解释你所写的内容,但是出现错误更新或取消更新没有AddNew或编辑

请问.update和结束于必须去你在这里写的地方,还是能以某种方式走到尽头?我正试图让表单只检查员工。表单顶部的值,而不是每个单独的一天。个人日的员工投入是微不足道的;只需要输出的主要形式。谢谢你的帮助!
Thanks Adezii!

One thing that is a little tricky is that the code above is only a sample of the entire string. After "Me.EMPLOYEE.Value", there is a whole bunch of code that records other aspects - hours, percentage of time, etc. for all 7 days, and then there is yet more code that resets the entire form to blank. I tried to interpret what you wrote to go at the end of the entire string but an error came up "Update or CancelUpdate without AddNew or Edit"
Would the ".update" and "End With" have to go where you wrote it here or can it go to the end somehow? I''m trying to get the form to check just the "EMPLOYEE" value at the top of the form, not for each individual day. The individual day employee input is trivial; just needed for the main form for output. Thanks for you help!


这篇关于尝试在没有必需名称字段的情况下停止表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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