If else not read properly after changes made to any document

无人久伴 提交于 2019-12-11 16:07:35

问题


I have a button in a form where I'm using If else to check whether in list of document in view, "IF" any document with status "Lock", I will prompt messagebox "Complete PC Inspection First!". So

At first, after the button is click, and code run and everything is working. Then I try to click the button again without made any changes it will prompt the messagebox.

But when I made a changes in any document and change status to others such as "Active", and I go back to the form and click the button, it not prompting the message, but it skip the first If and proceed to else.

Below is my code:

If doc.PStatus(0) = "Lock" Then
    Msgbox "Complete PC Inspection first!"
    Exit Sub
Else
    answer% = Messagebox("Do you confirm with this infomation?", 4,"Batch Number")
    Some code...
    ...
End If

What I want to do is the button will not proceed to "else" if there still have "Lock" status in any document in the view. It will continue to "else" when there is no "Lock" status in the view. Any help will be appreciated. Thanks!


回答1:


Better use a view that contains all Locked documents, ordered by the PC key or so. Or use a view sorted by key and Status, so you can pick out all locked documents for a specific PC. If there aren't any, GetDocumentByKey will return Nothing.



来源:https://stackoverflow.com/questions/56593781/if-else-not-read-properly-after-changes-made-to-any-document

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