How To Lock And Unlock A Document
First make a Access Field in your Form then make a Script Libary and then add
the Codes in the Script Libary.
Sub CheckInOutPostopen(Source As Notesuidocument)
If source.IsNewDoc Then
source.Editmode=True
Call source.refresh
Else
source.Editmode=False
End If
End Sub
Sub CheckInOutQuerymodechange(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim doc As NotesDocument
Dim un As New NotesName(session.UserName)
Set doc=Source.Document
If doc.Access(0)="" Then
doc.Access=un.Common+ " since "+Cstr(Now)
Call doc.Save(True,True)
Print "Locked "+doc.Access(0)
Else
Continue=False
End If
End Sub
Sub CheckInOutQueryclose(Source As Notesuidocument, Continue As Variant)
Dim doc As NotesDocument
If source.EditMode Then
Set doc=source.Document
doc.Access=""
Call doc.Save(True,True)
Print "Unlocked"
End If
End Sub
Then in the Form
Sub Postopen(Source As Notesuidocument)
Call CheckInOutPostOpen(Source)
End Sub
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
Call CheckInOutQueryModeChange(Source, Continue)
End Sub
Sub Queryclose(Source As Notesuidocument, Continue As Variant)
Call CheckInOutQueryClose(Source, Continue)
End Sub