Examples: QueryModeChange event

  1. This script prevents the user from switching to Edit mode and displays a message informing the user that the document cannot be edited.
    Sub Querymodechange(Source As Notesuidocument, _
    Continue As Variant)
      If Not ( source.EditMode ) Then
        Messagebox( _
        "Sorry, the text you wrote can't be edited.")
        continue = False
      End If
    End Sub
  2. This script checks whether the user is switching from Read mode to Edit mode. If so, and if the Status field reads "Closed," the script displays a message and prevents the user from switching to Edit mode.
    Sub Querymodechange(Source As Notesuidocument, _
    Continue As Variant)
      If Not ( source.EditMode ) Then
        currentStatus = source.FieldGetText( "Status" )
        If ( currentStatus = "Closed" ) Then
          Messagebox _
          ( "Document available for browsing only." )
          continue = False
        End If
      End If
    End Sub