Subject: RE: Response delete
Yes i delete from view with “Delete” key on the keyboard!
Here is the code that is in QueryDocumentDelete(I didnt wrote it):
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
'continue = True
'Exit Sub
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim dc As NotesDocumentCollection
Dim Responses As NotesDocumentCollection
Dim doc As NotesDocument
' zabrana brisanja sa tipkovnice
If ws.CurrentView.View.Name = "Deleted Documents" Then
continue = False
Exit Sub
End If
'The first step is to get a handle on all the documents marked by the user for deletion. This is done by
'using the Document property of the NotesUIdatabase which returns a document collection of all the documents marked for deletion.
Set dc = Source.Documents
'The next step is to have the user verify that Yes they want the documents deleted. The messagebox statement is nested in the If statement.
'If the user answers No to the question, no processing is performed on the selected documents.
Beep
If Messagebox("Odabrali ste " & dc.Count & " dokumenata da obrišete. Da li ste sigurni?" , _
36 , "Potvrda brisanja dokumenata") = 6 Then
'If the users answered yes, we get a handle on the first document in the collection. The Do statement forces the code to continue
'until the variable doc is Nothing, meaning a Set doc = … returned nothing.
Set doc = dc.GetFirstDocument
Do Until (Doc Is Nothing)
'This is the heart of the operation. The view selection formulas in the sample database are based on the form used to create the document, the
'field value is changed to “Deleted Documents” If your view selection formulas are based on other field, you would have to change that field’s value
'here to ensure the deleted document does not appear in that view.
doc.OldForm = doc.Form
doc.Form = "Deleted Document"
'This code is used to identify who and when the document was deleted.
doc.DeletedBy = S.CommonUserName
doc.DeletedOn = Now
'The cha nges made to the document are saved.
Call Doc.Save(True, False)
'Check to see the document has at least one response document.
'If there is at least one response document, the subroutine ProcessResponseDocuments is called.
'This is done to avoid orphaned response documents.
’ Although the user may have selected the response documents at the same time,
’ I have found that it is better to process them as if the user did not select them.
'If you count on the user selecting the main document and all of its descendants,
’ you are bound to have orphaned documents.
Set Responses = doc.Responses
If Responses.Count >0 Then
continue = False
Call ProcessResponseDocuments(s, Responses)
Else
continue= True
End If
'Get a handle on the next document in the document collection and start the process again.
Set doc = dc.GetNextDocument(doc)
Loop
'Refreshs the view the user has open. This removes all the documents which have just been processed.
Call ws.ViewRefresh
End If
'This Continue = False disables the conventional document deletion.
Continue = False
End Sub