Lotus Notes FAQ Visit Our Sponsor!

How do you prevent orphan response documents?

The Database Script in Notes 4.5 has a PostDocumentDelete event which is called when documents are deleted. You can use it to automatically delete response documents associated with a document:

Sub PostDocumentDelete(Source As NotesUIDatabase)
  Dim db As NotesDatabase
  Dim doc As NotesDocument
  Dim coll As NotesDocumentCollection
  Dim coll2 As NotesDocumentCollection
  Dim curdoc As NotesDocument
  Set db = source.Database
  Set coll2 = source.Documents
  For x = 1 To coll2.Count
    Set curdoc = coll2.GetNthDocument(x)
    Set coll = curdoc.Responses
    If coll.count > 0 Then Call coll.RemoveAll(True)
  Next
End Sub


Applies to Notes Versions: 4.5, 4.6, 5
Last Modified: May 10, 1997