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