InStr causing Overflow error

Here is a snippet of my code:

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

view2.AutoUpdate = False

Set pdsearch = settingsDoc.GetFirstItem(“PreviousDrivers”)

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

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

position = Instr(pdsearch.Text, driversname)

While Not position = 0

Set driversDoc = view2.GetNextDocument(driversDoc)



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



position = Instr(pdsearch.Text, driversname)

Wend

pdsearch is of type NotesItem and position is of type Long. For some reason, when this code runs, I get an overflow error.

Subject: RE: InStr causing Overflow error

Use the debugger. Find out what line the error is occurring on. See what the values of the variables are at that point.

See this article and this one for help with debugging.