Examples: UnLock method (NotesForm - LotusScript®)

This view action attempts to unlock the form named "Main Document." Unlocking is successful if the effective user is one of the lock holders.

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Set db = session.CurrentDatabase
  REM Exit if locking is not enabled
  If Not db.IsDesignLockingEnabled Then
    Print "Design locking not enabled"
    Exit Sub
  End If
  REM Get form
  Dim form As NotesForm
  Set form = db.GetForm("Main Document")
  REM Unlock form
  REM Form is not unlocked if error is raised
  On Error Goto errh
  Call form.UnLock
  Print "Form unlocked - " & form.Name
  Exit Sub
  Print "Form NOT unlocked - " & form.Name
  Exit Sub
End Sub