GetNextDocument (NotesDocumentCollection - LotusScript®)

Given a document, finds the document immediately following it in a collection.

Defined in



Set notesDocument = notesDocumentCollection .GetNextDocument( document )



NotesDocument. Any document in the collection. If you specify Nothing, this method generates an error.

Return value


NotesDocument. The document following the notesDocument parameter in the collection. If there is no next document, returns Nothing.


When processing documents in a loop, do not delete the document, or modify it in a way that causes it to disappear from the view or for its position to change. In that situation, GetNextDocument method may not return a useful result because the document that was the next document, is now at a different position in the view. The most common symptom of this problem is that documents are skipped when you loop through them.

To address this issue, change your logic so that you call GetNextDocument before making any change to the document. Or, use NotesView.AutoUpdate (= False) to prevent re-indexing of the view while you're using it.