Private view

I made private view becoming private with the first opening. I want that the users can create filters. The creation of filters changes the formula of selection of the view. When the view is on the server the change of formula of selection run well. But if the view is private Notes generates a fatal error. Some can help me? Thank you

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim collection As NotesDocumentCollection

Dim profil As Notesdocument

Dim item As NotesItem

Dim tabFiltre (10) As String

Dim response As Variant



Set profil = db.GetProfileDocument("ProfilPersonnel", session.UserName)



For x = 1 To 10

	Set item = profil.GetFirstItem("Description" + Cstr(x))

	tabFiltre (x) = item.Text

Next



response = ws.Prompt (PROMPT_OKCANCELCOMBO, Fulltrim(tabFiltre))



If Not Isempty (response) Then

	

	For y = 1 To 10

		Set item = profil.GetFirstItem("Description" + Cstr(y))

		If item.Text = response Then

			Set item = profil.GetFirstItem("Filtre" + Cstr(y))

			chaine = item.text

		End If

	Next

	

	'Messagebox chaine, 0+48, "Avertissement"

	view.SelectionFormula = "Select (Form=""Tache"" : ""SousTache"" : ""SSTache"")" + chaine

	Call view.Refresh

	Call ws.ViewRebuild (True, True)

	

End If

End Sub