Searching for a date in a document collection

I have a group of documents that store a date. I have tried to use search and ftsearch to compare a date to the field, but I can’t seem to work out the query.

Once I have the date inside my program, I format it using CDate. When I look at the query I get it as field=“3/18/10” which to me looks correct.

My question is this, how do get a listing of all of the documents that have a date less than a user given date.

Here is some code that I’ve tried.

parmDate = CDat(parm2)

q = {creationDate < “} + parmDate + {”}

Set dc = db.Search(q,nothing,0)

or

Set dc = db.FTSearch(q,0,1543)

Thank for the assistance.

-Kris

Subject: FTSearch Against Dates

“My question is this, how do get a listing of all of the documents that have a date less than a user given date.”

If the user is prompted for the date, you’re probably getting it as a string, userDateStr, in the format MM/DD/YYYY. Keep it that way.

Using view.FTSearch: #docs = view.FTSearch([dateFieldName] < userDateStr)

Using db.FTSearch: docCol = db.FTSearch([dateFieldName] < userDateStr)

Subject: date search

The db.search syntax is exactly like a selection formula, so you’d need Date<[01/01/2010] for example. If you put quotes in it’s looking for a string so won’t work