Sometimes when you get a document collection for a LotusScript agent to handle, Notes passes you a deletion stub (this is probably a bug). In case you have to handle it, you can use this code:
' From Mike Woolsey ' IsErr_NOTES_ERROR is 4000 On Error lsErr_NOTES_ERROR Goto HandleDocError dim failureCode as Integer ' may be global dim test as Variant ..... set doc = dc.GetFirstDocument ' say this is a FTS result collection, the doc may have been deleted since it was indexed while not(doc is Nothing) failureCode% = 0 test = doc.Items if failureCode% = 0 then ' no error .... ' handle document end if set doc = dc.GetNextDocument(doc) wend .....
HandleDocError: failureCode% = Err Resume next