Dim dsession As New NotesSession
Dim db As NotesDatabase
Set db = dsession.CurrentDatabase
Dim dcollection As NotesDocumentCollection
Set dcollection = Source.Documents
Dim dresponses As NotesDocumentCollection
Dim ddoc As NotesDocument
Set ddoc = dcollection.GetFirstDocument
Dim IsConflict As Variant
Do While Not ddoc Is Nothing
'Allow Replication or Save Conflicts to be deleted in any event.
IsConflict = Evaluate("@IsAvailable($Conflict)", ddoc)
If IsConflict(0) Then
Continue = True
Exit Sub
End If
'Prevent children documents from being orphaned
Set dresponses = ddoc.Responses
If dresponses.Count <> 0 Then
Messagebox "Sorry, you may not delete this Document because it contains child Documents. " & _
"First delete the child documents, then delete the Parent Document."
Continue = False
Exit Sub
End If
Set ddoc = dcollection.GetNextDocument(ddoc)
Loop