Thursday, June 21, 2012

View entry not found in view index on Lotusscript error

Hi Today I had a simple problem but it wasted my little more time. Actually I am checking the documents one by one from a view.

See the code below:- [Code has been modified because of public]

Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As notesview
    Dim doc As notesDocument
    Set db=session.CurrentDatabase
    Set view=db.GetView("vwFirst")
    Set doc=view.GetFirstDocument
    While Not doc Is Nothing
        If doc.field_Name(0)="User : 99999" Then
            Msgbox "Test"
            doc.field_Name="User : 99999"
            Call doc.Save(True,False)
        End If
        Set doc=view.GetNextDocument(doc)
    Wend

While executing the code, Whenever the document is saving, there I am getting the view entry not found error. After some heading with this code and view. I got a idea that why not the document collection have been affected after the document is being saved. Yes that is the solution. After saving the document the view's document has inter changed depends on their modification date.

Finally the solution is, Please add the view.autoUpdate=false This will solve the problem easily.

No comments:

Post a Comment