Subject | Re: Adding search criteria to WHERE clause and more..not working as expected. |
---|---|
Author | mspencewasunavailable |
Post date | 2007-01-13T16:14:56Z |
--- In IBObjects@yahoogroups.com, "Adrian Wreyford" <wreymed@...>
wrote:
procedure <suitable object>.RestrictToDOB(Sender: TObject);
begin
(Sender as TIBODataset).SQLWhereItems.Add('ANIMAL.ANIMALDOB
BETWEEN ''' +
DateToStr(DTPBeg.Date) + ''' AND ''' + DateToStr(DTPEnd.Date)
+ ''' ');
end;
Then assign it:
IBOQuery1.OnPrepareSQL := <instance of the suitable
object>.RestrictToDOB;
I don't think you need to do this Prepare any more:
result of this).
Mockingbird Data Systems, Inc.
wrote:
>today I
> Well I asked a similar question a week ago, and no answer. But
> stumbled on something I think is the answer, but cannot get ti towork.
>between dates
>
>
> I want to assign Search criteria to a report Query, then add a
> clause for Date OF Birth field to the where clause, and then runthe report.
>appear to add
>
>
> I thought the following would do, but the add items, doesn't
> the item:here?
>
> I put the dataset into prepare state; must be missing something
>Declare an OnPrepareSQL event handler:
>
procedure <suitable object>.RestrictToDOB(Sender: TObject);
begin
(Sender as TIBODataset).SQLWhereItems.Add('ANIMAL.ANIMALDOB
BETWEEN ''' +
DateToStr(DTPBeg.Date) + ''' AND ''' + DateToStr(DTPEnd.Date)
+ ''' ');
end;
Then assign it:
IBOQuery1.OnPrepareSQL := <instance of the suitable
object>.RestrictToDOB;
I don't think you need to do this Prepare any more:
>Do this, though (I think the OnPrepareSql event gets called as a
> IBOQuery1.Prepare;
>
result of this).
> IBOQuery1.AssignSQLWithSearch(IB_Query1);Michael D. Spence
> IBOQuery1.Open;
>
Mockingbird Data Systems, Inc.