SelectionFormula property returning wrong formula on private on first use views

To overcome the problems with using @UserName in the selection formula of a private on first use views stored in the database (indexer/updall messing up view index, documents missing in view), I have added some code to the queryclose event of the view:

Sub Queryclose(Source As Notesuiview, Continue As Variant)

Call GetPrivateViewSelection(Source.View)

End Sub

Sub GetPrivateViewSelection(View As NotesView)

Dim Session As New NotesSession

Dim UserName As New NotesName(Session.UserName)



CurFormula$ = View.SelectionFormula

UserNameAbb$ = """" + UserName.Abbreviated + """"



Select Case View.Aliases(0)

Case "va_PRIVATE_OWN_CUSTOMERS":

	NewFormula$ = "SELECT Form = ""fa_CUSTOMER"" : ""fa_CUSTOMER-CONTACT"" & @IsMember(" + UserNameAbb$ + "; fl_Responsible) | @IsResponseDoc"

Case "va_PRIVATE_FOLLOWUP_OWN":

	NewFormula$ = "SELECT fl_Group = ""C"" & fl_ExpireReceiver = " + UserNameAbb$ + " & fl_ExpireDate != """""

Case "va_PRIVATE_VISIT_BY_DATE":

	NewFormula$ = "SELECT Form = ""fa_VISIT-REPORT"" & @IsMember(" + UserNameAbb$ + " ; fl_Responsible)"

End Select



If CurFormula$ <> NewFormula$ Then

	Print CurFormula$

	Print NewFormula$

	View.SelectionFormula = NewFormula$

	Print "Updating selection formula..."

End If

The line CurFormula$ = View.SelectionFormula returns the selection formula of the original parent view though, but the line View.SelectionFormula = NewFormula$

correctly sets the formula in the users private view. Hence, the formula is always updated. Is it a bug that View.SelectionFormula of a private view returns the formula of the original Shared, private on first use view? I have checked that is is the private view I have a handle on, by checking the view.universalid property.