0
votes

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
There is a debugger built in Notes. Tools -> Debug LotusScript. Activate it before you open the db and step through your code. Then you should probably find out why youre objects are note refreshed.umeli
What is doc? Where are you accessing the view? Your code is incomplete.Duston
You need to re-write the question. MsgBox and Messagebox are the same function, so I don't know what you mean when you say ""it will prompt the messagebox" and "it not prompting the messagebox". Which messagebox is it prompting? Which one is it not prompting? And you need to show all of your code. You need to at least show the entire loop. There must be a loop somewhere, I hope.Richard Schwartz

1 Answers

1
votes

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.