Prevent button to execute if field is empty and “status” still in the database

人走茶凉 提交于 2019-12-11 15:46:43

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/56829458/prevent-button-to-execute-if-field-is-empty-and-status-still-in-the-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!