I have a form(TrimQuery) that has 2 editable date picker fields (Start_Date & End_Date) and a button. On the push of a button I need to pull up a pre-existing view(All Trim Tracking) from another Form(Trim Track) that polls a field(Trim_Date) and displays all documents between the dates I specified in the (TrimQuery) form using the date pickers. I have posted the code below.
Is there another way to view documents between two dates? I think most of my problem lies in the selection formula, which I have posted with the code, but I know it’s incorrect. I’ve tried to grab bits of code from other examples. Please pick this apart. I appreciate any help I can get . Thanks.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim workspace As NotesUIWorkspace
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim StartDate As NotesItem
Dim EndDate As NotesItem
Dim Trimming As String
Trimming = "Trim Track"
Set StartDate = doc.GetFirstItem("Start_Date")
Set EndDate = doc.GetFirstItem("End_Date")
Set uidoc=workspace.CurrentDocument
Set db=session.CurrentDatabase
Set view=db.GetView("All Trim Tracking")
SF = {SELECT Trim_Date = "} & StartDate.Text & "&" & EndDate.Text & {" | (Form = }& Trimming & {")} <==I realize this is incorrect, I don't know the correct formula.
If StartDate.Text <> "" And EndDate.Text <> "" Then
view.SelectionFormula = SF
Else
view.SelectionFormula="select @all"
End If
End Sub
You can express date ranges in selection formulas: