Hallo, hier nochmal eine getestete Zusammenfassung - Mit Sub für rekursiven Aufruf...
'========================================================================================
' Dokumente mit Responses in View löschen
' Start über Action-Button in entspr. View
'========================================================================================
Sub Click(Source As Button)
On Error Resume Next 'Errorhandler
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim dc_parent As NotesDocumentCollection 'Doc Collection Parent
Dim doc_parent As NotesDocument
Dim countresp As Integer
Set db = session.CurrentDatabase
Set dc_parent = db.UnprocessedDocuments 'von User gewähltes Doc (Cursorbalken in View)
Set doc_parent = dc_parent.getFirstDocument()
REM === Prüfen, ob Responses vorhanden sind
Dim dc_child As NotesDocumentCollection 'Doc Collection Children
Dim doc_child As NotesDocument
Set dc_child = doc_parent.Responses
Set doc_child = dc_child.GetFirstDocument
While Not (doc_child Is Nothing)
countresp = countresp + 1
Set doc_child = dc_child.getNextDocument(doc_child)
Wend
REM ===
REM === Wenn Responses vorhanden, Sub deleteChilds aufrufen
If countresp > 0 Then
Call deleteChilds(doc_parent) 'Aufruf Sub deleteChilds
End If
REM ===
Call doc_parent.RemovePermanently(True) 'Parent Doc löschen
Call workspace.ViewRefresh 'View aktualisieren
End Sub
'========================================================================================
' Routine, um Responses zu löschen (rekursiver Aufruf)
' doc_parent wird übergegen
'========================================================================================
Sub deleteChilds (doc_parent As NotesDocument) 'Parent übernehmen
Dim dc_child As NotesDocumentCollection 'Doc Collection Children
Dim doc_child As NotesDocument
Set dc_child = doc_parent.Responses
Set doc_child = dc_child.GetFirstDocument
While Not (doc_child Is Nothing)
Call doc_child.RemovePermanently(True)
Call deleteChilds(doc_child)
Set doc_child = dc_child.getNextDocument(doc_child)
Wend
End Sub