I have this code that prevents deleting documents based on Access level. It is in the Querydocumentdelete in the Database Script.However, I want it to apply to only documents that use two forms “Summer” and “Winter”.
I added "If doc.form(0) = “Summer” And level <5 Then…
but it does not work. The whole code is below. Any ideas? Thanks.
Sub Querydocumentdelete(Source As NotesUIDatabase, Continue As Variant)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim i As Integer
Dim entry As NotesACLEntry
Dim level As Integer ’ ACL level
Dim c As NotesDocumentCollection ’ Collection of Deleted Documents to be processed
Dim doc As NotesDocument ’ Current doc being deleted
Dim item As NotesItem ’ Authors field on document
Dim f As String
Dim ami As Integer ’ Success or Failure integer
’ Get User
Dim user As String
user = session.UserName
’ Get current ACL for user
Set db = session.CurrentDatabase
Set acl = db.acl
If acl Is Nothing Then
’ If acl is nothing then the person has no access to the database and is only in because of public documents
Continue=False
MessageBox( “Your access level does not allow you to delete documents.” )
Exit Sub
End If
Set entry = acl.GetEntry( user)
level = entry.level
’ If ACL level less than author…
If level <5 Then
Continue=False
MessageBox( “Your access level does not allow you to delete documents.” )
Exit Sub
End If
’ If ACL delete documents checkbox is not selected
If entry.CanDeleteDocuments=False Then
Continue=False
MessageBox( “Your access level does not include the check box to delete documents.” )
Exit Sub
End If
’ If ACL level is manager…
If level >5 Then
Continue=True
GoTo SkipToEnd
End If
SkipToEnd:
Exit Sub
End Sub