Hi guys,
This is irritating me to no end. I use doc.lock to lock the document when a user opens it for editing. Other users are able to open it for viewing. If they click edit, they are prevented. Great. However, when the first user saves their document, the user with an already open document is able to click edit - is warned the doc was modified - but it able to click ok, then edit, and go into edit mode. A save conflict results. How do I stop a user from editing a document which was modified after they opened it?
I tried to get the modified field via @modified in the open event and then compare it to @modified when they tried to go into edit mode but the functions return the same time despite the doc having been changed. Notes knows the document was modified since it was opened, how can I? Or how can I force doc.locking to close that document when it detects it needs to be refreshed from the view?
Just in case:
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If (source.IsNewDoc = False) Then
Set doc = source.document
Call doc.lock()
End If
End Sub
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Set doc = source.Document
user = Evaluate("@UserName")
If (doc.lockholders(0) <> "") Then
If (user(0) = doc.lockholders(0)) Then Call doc.UnLock()
End If
End Sub