If else not read properly after changes made to an

2019-08-30 06:48发布

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条回答
一纸荒年 Trace。
2楼-- · 2019-08-30 07:32

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.

查看更多
登录 后发表回答