Board index » delphi » Table filter dates

Table filter dates

Can someone tell me how to correct this?  When I code this filter with
this line of code.  I get this error:

Table1.Filter := ('EVENT_DATE'  >  datetostr(AstartDate))  AND
('EVENT_DATE'  <  datetostr(AEnddate));

Error returned: [Error] Unit1.pas(64): Incompatible types: 'String'
and 'Boolean'

Coded this way:

Table1.Filter := '(EVENT_DATE  >'  datetostr(AstartDate))  AND
'(EVENT_DATE <'  datetostr(AEnddate));

Error returned:  "Arithmetic"

 

Re:Table filter dates


Try to adjust your quotes to yield a concatenated string:

  Table1.Filter := '(EVENT_DATE >'+ datetostr(AstartDate) +
                          ')  AND (EVENT_DATE  <'  +
datetostr(AEnddate)+')';
This should work for you.

David

Quote
"Tony" <data_wiz...@hotmail.com> wrote in message

news:47adb77.0110071909.2d867942@posting.google.com...
Quote
> Can someone tell me how to correct this?  When I code this filter with
> this line of code.  I get this error:

> Table1.Filter := ('EVENT_DATE'  >  datetostr(AstartDate))  AND
> ('EVENT_DATE'  <  datetostr(AEnddate));

> Error returned: [Error] Unit1.pas(64): Incompatible types: 'String'
> and 'Boolean'

> Coded this way:

> Table1.Filter := '(EVENT_DATE  >'  datetostr(AstartDate))  AND
> '(EVENT_DATE <'  datetostr(AEnddate));

> Error returned:  "Arithmetic"

Other Threads