Call uiw.ViewRebuild not working

Sub Initialize Dim session As NotesSession

Dim uiw As New NotesUIWorkspace

Dim uiview As NotesUIView

Dim view As NotesView

Dim doc As NotesDocument

Dim formula As String

Dim item As NotesItem	

Dim one As String

Dim two,choice,server,datab,salesman,salesmanNum As String

Dim ct As Integer

Dim picklist As Variant

Dim messagelist As String

Dim dateonly As New NotesDateTime("")

Dim i As Integer	

Set uiview = uiw.CurrentView

Set view = uiview.View

Set session = New NotesSession

Set db  = session.CurrentDatabase	

Set doc = view.GetFirstDocument

Set uiw = New NotesUIWorkspace

On Error Goto Errhandle	

choice = session.GetEnvironmentString("Superbisor")

supervisor = session.GetEnvironmentString("supervisor")

formula = |	SELECT ((Form = "Sales performance dashboard"  &   @Contains(@Trim(salesman_SPD);"|& choice & |" ))|

formula2 = |	SELECT ((Form = "Sales performance dashboard"  &  Year_SPD=2010  & @Contains(@Trim(salesman_SPD);"|& choice & |")))|	

Msgbox(formula2)	

view.SelectionFormula = formula2

Call uiw.ViewRebuild

dateonly.LSLocalTime = Now



ct = view.EntryCount

i=1	

Do While (i<=ct)		

	

	Set item = doc.ReplaceItemValue("SALES_SUPERVISOR",supervisor)



	

	Call doc.Save(True,True)

	

	Set doc = view.GetNextDocument( doc )

	i= i+1		

Loop



Msgbox(ct)

Errhandle:

Exit Sub	

End Sub

why dosen’t the view rebuild work?

Subject: Re: View Rebuild not working

What makes you think the view rebuild is the problem? Did you debug the code? What does it do that you consider a failure?

Do not use the SelectionFormula property of a view to do searches. This is not efficient, and the client’s caching of design elements means it might not work. Instead, create a view that’s sorted by the fields you want to search for, and use GetAllDocumentsByKey to retrieve the documents. Read the documentation about the arguments of this method, particularly that you can use an array of keys.

You might also want to look at the StampAll method.