Stop edits on modified document or doc locking again

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

Subject: Reload

Could you do a NotesUIDocument.Reload when the mode of the document is switched from Read to Edit (form event: Postmodechange)?

Subject: RE: Reload

Doesn’t work. Never grabs the ‘new’ document off disk. Just refreshes the current doc in memory. Help anyone?

Subject: RE: Reload

Just set Continue = False in the querymodechange so the user is forced to exit the doc if in view mode. Only allow edit mode from the view level.

Subject: Close and re-open

In Querymodechange just close and re-open the document:

Dim workspace As New NotesUIWorkspace

Dim doc As NotesDocument

If Source.EditMode = False Then

Set doc = Source.Document

Source.Close

workspace.EditDocument True , doc

End If

End Sub

Subject: RE: Close and re-open

Doesn’t work. This makes notes warn the user when saving the document that it has been modified. It also removes the doc lock. Ideas?

Subject: RE: Close and re-open

Hi Robert,

I have the same wish.

Have you found a solution since ?

thanks in advance

Luc