I’m building an query statement to search a FTIndexed DB. I recently added some date parameters which I cannot seem to get to work (doesn’t find documents…search retuns 0 documents found).
Here’s the funny thing… I debug the code, grab the query line that’s build…pluck into the search bar of a view (only remove the quotes around the statement)and it works (finds correct documents)!
I’m thinking it’s a notation issue…any help would be greatly appreciated…code below:
Dim item1 As NotesItem
Dim item2 As NotesItem
Set item1=tempdoc.GetFirstItem("FromDate")
Set item2=tempdoc.GetFirstItem("ToDate")
If tempdoc.FromDate(0) <> "" And tempdoc.ToDate(0) <> "" Then
If Query = "" Then
Query = "FIELD ExpiryDate >= " & item1.Values(0) & " AND FIELD ExpiryDate <= " & item2.Values(0)
Else
Query = Query + " AND FIELD ExpiryDate >= " & item1.Values(0) & " AND FIELD ExpiryDate <= " & item2.Values(0)
End If
End If
Note: Focus on the else line as the Query is already half build when it hits this part of script (with Status = “open”).
Here is the SQL line that’s produced:
“FIELD Status CONTAINS”“Open”" AND FIELD ExpiryDate >= 2000-03-16 AND FIELD ExpiryDate <= 2000-04-16"
Expiry date is a date/time field.
Thanks for any help again
Chris