NotesView.SelectionFormula

It’s not mentioned in the Help, but does a user need to have Designer access to a database to be able to run code that usesNotesView.SelectionFormula, even if it’s in a private view? (According to this post, it’s necessary for shared views, but doesn’t sound like it should be for private views: https://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/9244d8bc98253f65852570820047e39c?OpenDocument) I need a way to allow users to filter a view to create customized reports, and @SetViewInfo won’t work (it’s not a categorized view, and we need to filter based on field values, not column values.) I’ve tested it, and even though the ID I’m using has access to create private views, when the code hits the line

using NotesView.SelectionFormula, it throws a “you are not authorized to perform that action” error.

Here’s the code:

Sub Click(Source As Button)

  On Error Goto errhand



  Dim ws As New NotesUIWorkspace

  Dim uiview As NotesUIView

  Dim view As NotesView

  Dim formula As String

  Dim monthYear As String

  Dim monthStr As String

  Dim yearStr As String



  Set uiview = ws.CurrentView

  Set view = uiview.View



  monthYear= Inputbox("Please enter desired month and year

(mm/yyyy)",“Set New View Selection”)

  If monthYear = "" Then

        Msgbox "You did not enter a month and year; please try again."

        Exit Sub

  End If



  monthStr = Strleft(monthYear, "/")

  yearStr = Strright(monthYear, "/")





  formula = "SELECT Form=""regForm"" &  @Month(StartDate) = " &

monthStr & " & @Year(StartDate) = " & yearStr & " & Approval != "“3"” &

Approval !=““4"” & classAttend=”“Yes”“”

  view.SelectionFormula =  formula 'this is the line that's erroring

out

  Call view.refresh

  Call ws.ViewRebuild



  Exit Sub

errhand:

  Msgbox "error at line " & Erl & ": " & Error

  Exit Sub

End Sub

Subject: Setting the view?

  1. Did you check the vew.IsPrivate property to make sure that the view is private?

  2. Is it possible that you have the problem because the view was set from uiview? What happens if you set the view by using notesdb.GetView()?

Subject: RE: Setting the view?

  1. Yes, the view is private.2) I’ll try that and see if it makes a difference.

Subject: NotesView.SelectionFormula

You might be happier using a server agent to create the view for them, and having it alter the selection formula and so on. It sounds bad to put views like that on the server, but if you create them from a view that’s set to discard its index after 7 days (or less) it’s not too bad. And you can have a second agent to run once a month to clear them out of the design if they haven’t been touched in a while.

Subject: RE: NotesView.SelectionFormula

That’s not an option - we have almost a thousand people who are going to need these views, and they will all be used on a regular basis.