Examples: GetPrevDocument method (NotesDocumentCollection - LotusScript®)

This script gets the second-to-last document in a collection, and assigns it to the secondToLastDoc object.

Sub Click(Source As Button)
  Dim session As New NotesSession
  Dim db As NotesDatabase
  Dim collection As NotesDocumentCollection
  Dim lastDoc As NotesDocument
  Dim secondToLastDoc As NotesDocument
  Set db = session.CurrentDatabase
  Set collection = db.FTSearch("Annual reports", 10)
  Set lastDoc = collection.GetLastDocument
  Set secondToLastDoc = collection.GetPrevDocument( lastDoc )
End Sub