如果字段为空并且显示“状态",则阻止按钮执行.仍在数据库中 [英] Prevent button to execute if field is empty and "status" still in the database

查看:75
本文介绍了如果字段为空并且显示“状态",则阻止按钮执行.仍在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有某些字段的表单和一个要执行的按钮.我想做的是,当任何字段为空时,按钮都无法执行.这意味着,当字段未完成时,我无法继续按钮操作.

如果字段为空,如何防止按钮执行?任何帮助将不胜感激.谢谢!

**更新问题**

我将为我的问题添加更多信息.目前,我尝试阻止使用

If doc.PStatus(0) = "Lock" Then
    Msgbox "Complete PC Inspection first!"
    Exit Sub
Else

要检查状态是否为LOCK,则无法执行该按钮.如果我对文档进行了一些更改,但仍处于锁定"状态,则无法继续执行该按钮.我将提示消息首先完成PC检查!".并退出子.我以为我成功了,但没有成功.我尝试两个条件:

  1. 我尝试对文档进行更改,但没有从视图中的第一个文档开始. (没关系,我无法继续执行流程)
  2. 我尝试仅在视图中对第一个文档进行更改,然后我可以执行按钮(据说我不能执行该操作,因为它仍然处于锁定"状态).

我从上一个问题尝试,但问题仍然存在.仅当我更改了我的第一个文档时才出现问题.但是,如果我对除第一个文档以外的其他文档进行了更改,那没有问题.我希望你能理解这个问题.如果您需要,我会添加其他代码.谢谢!

解决方案

如果该按钮在视图中,则您的代码需要处于循环中,该循环获取每个文档并分别检查每个文档中字段的值. /p>

I have form with some field in it and a button to be execute. What I want to do is, when any of field is empty, the button cannot be executed. That means, I cannot proceed the button procees when the field is not completed.

How can I prevent the button to be execute if field empty? Any help will be appreciated. Thanks!

**Update Question**

I will add some more information to my problem. For now, I'm try to prevent using

If doc.PStatus(0) = "Lock" Then
    Msgbox "Complete PC Inspection first!"
    Exit Sub
Else

to check if there is status LOCK then I cannot execute the button. If I made some changes to the document and there still LOCK status, I cannot proceed the button. I will prompt message "Complete PC Inspection first!" and exit sub. I thought I succeed but not. I try two condition:

  1. I try made changes to document but not start with first document in the view. (Its ok and I cannot proceed to execute process)
  2. I try made changes to the first document only in the view, then I can execute the button (where supposedly I cannot because there still "LOCK" status).

I try this from my previous question but the problem still occurred. The problem occurred only when I made changes to my very first document in view. But there is no problem if I made changes to other document other than first document. I hope you understand the question. I will add additional code if you guys need. Thank you!

解决方案

If this button is in a view, your code needs to be in a loop that gets each document and separately checks the values of the field in each document.

这篇关于如果字段为空并且显示“状态",则阻止按钮执行.仍在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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