I’ve got some problem with Lotus Script Search method, not sure where i went wrong. Here’s my code:
Dim session As New notessession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Set db = session.currentdatabase
searchFormula$ = {Form = "Daily Hours Worked Report" & DateFld = "04/03/2003"}
Set collection = db.Search(searchFormula$,Nothing,0)
num = collection.Count
Messagebox "there are " + num + " documents dated the 04/03/2003"
Note:
DateFld is a field on the form, i just want to extract all the document with the specified date. With the above code, variable “num” always returns 0.
You’re treating “DateFld” as if it were a text field; is that correct? If it’s a date field, then your formula won’t include the quotes around the value you’re looking for.
Also, I’ve not tried passing Nothing as a value for the NotesDateTime; are you sure that works? I haven’t tested your code, so it may do… I usually do this:
Subject: Nothing is a perfectly correct parameter for the .Search function…
for when you do not want a cutoff date in the search. I would use the following formula: (Square brackets denote a date/time constant)searchFormula$ = {Form = “Daily Hours Worked Report” & DateFld = [04/03/2003]}