It functions regardless of the user's access.
One application is to keep database owners from deleting system critical
documents. (i.e. keyword lists)
The criteria used in this example is relatively simple. Real world applications
may require more complex criteria.
By the way, you might want to change the error message.
This example assumes a form containing a keyword field named 'FormName'.
The two choices for this field are:
Do Not Delete | N
Delete | Y
Place the following in the Database Script:
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
Dim DocsDelDC As NotesDocumentCollection
Dim DeleteMe As Integer
Dim doc As notesdocument
Set DocsDelDC = Source.Documents
Set doc = DocsDelDC.GetFirstDocument
While Not(doc Is Nothing)
Continue = True
'Never delete these docs per the following criteria.
If doc.FormName(0) = "N" Then
Continue = False
Print "One or more of the documents selected may not be
Messagebox "You Can't Delete Me . . . ", 48, "NaNa NaNa Boo
Set doc = DocsDelDC.GetNextDocument(doc)