NotesItem Contains Method Problem

Here is my code thus far:

Set view2 = driversDB.GetView(“DriversActiveNewDrivers”) 'populate view2

view2.AutoUpdate = False

Set driversDoc = view2.GetFirstDocument 'get first document in view2

driversname = driversDoc.FirstName( 0 ) + " " + driversDoc.LastName( 0 )

Set pdsearch = settingsDoc.GetFirstItem(“PreviousDrivers”)

'***Problem occurs in loop

Do While pdsearch.Contains(driversname)

    Set driversDoc = view2.GetNextDocument(driversDoc)



    driversname = driversDoc.FirstName( 0 ) + " " + driversDoc.LastName( 0 )

Loop

Set pdsearch = settingsDoc.GetFirstItem(“PreviousDrivers”)

Call pdsearch.AppendToTextList(driversname)

Call settingsDoc.Save(True, False)


pdsearch is of NotesItem type

settingsDoc is of NotesDocument type

I am getting an “Object Variable Not Set” error message.

My objective is to loop through my drivers database until I find a document that isn’t listed in the “PreviousDrivers” field of my settingsDoc which is found in a separate database.

Any help is appreciated,

Thanks.

Subject: NotesItem Contains Method Problem

There are a few possibilities here but are you making sure that driversDoc is not Nothing?If you run out of docs then that error will occur.

Leonardo

Subject: RE: NotesItem Contains Method Problem

I’m pretty sure that my code takes care of it, but I’m at home, so I’ll check at work in the morning.