Subject Re: Filter for Date Range
From Wayne Zimmerman <waynez.dbsolutions@gmail.com>
Date Tue, 20 Mar 2018 16:57:14 -0400
Newsgroups dbase.getting-started

I like to do this with a sql statement
form.xxxtable1 = query()
form.xxxtable1.sql = "select * from xxxtable where DATE_ <= :DATEFROM and DATE_ >= :DATETO order by DATE_"

      form.xxxtable1.params["DATEFROM"] = Date() - 365
     form.xxxtable1.params["DATETO"] = Date() +1
form.xxxtable1.active = true

Then you can update the search later by
form.xxxtable1.params["DATEFROM"] = Date() - 200
     form.xxxtable1.params["DATETO"] = Date() +1
form.xxxtable1.requery()

WayneZ


Patrick Healey Wrote:

> Good afternoon!
> Most of my tables have dates.  I would like to set a filter on a date range.  How is that done?  I have tried ctod(), dtoc(), dtos() and {}.  None worked - or at least not in the combination that I tried.
> I want to supply a start and end date.  Then filter that on the date field in the table with an expression like:
> form.xxxtable1.rowset.filter := "(Formdate > Start) AND (Formdate < End)"
> I set Start = Date() - 365 and End = Date() + 1 in the On Open for the form.
> Thank you in advance.
>
> Pat Healey