Finding all documents between two dates

Ok, I’m trying to find all documents created with a specific form that have been created between two dates. Now I can do it the long-winded way by grabbing each doc in a view and comparing it to several dates, but it strikes me that Db.Search would probably be more efficient. Only problem is that my search comes back with 0 documents found, and I know there are 3 test documents. Code:

Set Db = Session.CurrentDatabase

Set UIDoc = Workspace.CurrentDocument

Set docInput = UIDoc.Document

StartDate.LSLocalTime = docInput.StartDate(0)

EndDate.LSLocalTime = docInput.EndDate(0)

Set Collection = Db.search ({ (Form=“fReportableAccidents”) & (IncidentDate>= StartDate) & (IncidentDate <= EndDate) }, Nothing,0)

I’m sure its something obvious, I just can’t see it, help anyone?

Cheers,

Katherine

Subject: Need Date constants, not Field references…

note: changed your { }s to ||s for readability.

StartDate.LSLocalTime = docInput.StartDate(0)

EndDate.LSLocalTime = docInput.EndDate(0)

Set Collection = Db.search (|(Form=“fReportableAccidents”) & (IncidentDate>= [| + StartDate.DateOnly + |]) & (IncidentDate <= [| + EndDate.DateOnly + |])|, Nothing,0)