NotesUIDoc.Editmode=False in LotusScript

Hi,

I am having trouble with a looping script. What I am trying to do is edit a field when a document is opened, save it, then return to Browse mode for the user to view.

I have code in the QUERYOPEN event, and code in the POSTOPEN event.

In the POSTOPEN event as soon as it hits SOURCE.EDITMODE = FALSE, it jumps the the QUERYCLOSE event (dont have any code in there yet), then back to the QUERYOPEN, then the POSTOPEN.

I am presuming the Editmode=False forces notes to close and re-open the document. Is there any way around this that I can update the field contents, then return the user to Browse mode.

Many thanks, I have included the code below.

Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)

Dim ITEM As NotesItem

Dim LOCKED As String

Set ITEM = source.Document.GETFIRSTITEM("TXTLOCKED")

If Not (ITEM Is Nothing) Then

	LOCKED = item.Values(0)

End If



If LOCKED<> "" Then 

	Messagebox ("Document already open by " & LOCKED) 

	CONTINUE = False

End If

End Sub

Sub Postopen(Source As Notesuidocument)

Dim SESSION As New NOTESSESSION

Dim ITEM As NotesItem

Dim LOCKED As String

LOCKED = session.UserName

source.EditMode = True



Call source.fieldsettext ( "txtLocked", locked)

Call source.save

Source.EditMode=False

End Sub

Subject: NotesUIDoc.Editmode=False in LotusScript

stupid question (meaning, my question is stupid, not yours), why not just enable document locking in your database and let Notes handle this nativley?

Subject: RE: NotesUIDoc.Editmode=False in LotusScript

As far as I know the document locking feature only works for documents in edit. I want to lock documents open in browse.

Thanks for your thought anyway, I did think about the same.

Subject: NotesUIDoc.Editmode=False in LotusScript

Just figured it out. Ran the script through a New NotesSession instead of a UIDocument. I’m learning.

Cheers