Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next

How to Delete Docs in a Collection You Are Traversing

I know the original thread is talking about COM, but here is how I do it in regular code. The way to avoid the error is to set a temporary NotesDocument object to the next doc in the collection, and then reset your main doc object to that temp doc at the bottom of the loop. See below.

Dim dc As NotesDocumentCollection, doc As NotesDocument, docTemp as NotesDocument

' Set dc, then...

Set doc = dc.GetFirstDocument()

Do While Not (doc Is Nothing)
Set docTemp = dc.GetNextDocument(doc)

' Execute code that deletes doc.

Set doc = docTemp
Loop


Feedback response number WEBB9N6SLH created by ~Lex Minreteroni on 08/20/2014

COM: How to use GetNextDocument(doc... (~Naomi Brekrosk... 18.Jul.11)
. . Get an earlier reference (~Dana Kiachekle... 19.Jul.11)
. . . . But doc is deleted... (~Naomi Brekrosk... 19.Jul.11)
. . . . . . ... (~Dana Kiachekle... 19.Jul.11)
. . . . . . Unless you find a way to keep delet... (~Fred Asatumibu... 19.Jul.11)
. . . . How to Delete Docs in a Collection ... (~Ethan Prejipyl... 20.Aug.14)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS