Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim doc As NotesDocument
Set doc = Source.Document
If source.isnewdoc = False Then
Dim fval As String
fval = doc.fieldname(0)
If fval = "fieldvalue" Then
If source.EditMode = True Then
Messagebox "You cannot edit this document due to field value.", 16, "Edit Attempt Error"
continue=False
End If
End If
End If
End Sub