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