Subject | Help needed with search criteria refinement. |
---|---|
Author | Adrian Wreyford |
Post date | 2007-01-08T11:35:57Z |
Hello.
Helen previously helped me with the following line of code, and this was
just what I needed then.
IBOQuery1.AssignSQLWithSearch(IB_Query1);
This was needed, so that I could assign a search criteria to a IBOQuery for
use in a reporting tool (Report Builder).
I use the IB_Searchbar, and IB_Query1, with the necessary controls to select
fields etc.
This works fantastically, due to the line of code Helen helped with above.
Now I need to complicate matters more, by being able to search for a Date
between a start and end date, to further refine the search above.
So once I have searched for the necessary records. I assign the search:
IBOQuery1.AssignSQLWithSearch(IB_Query1);
But now I need to add:
IBOQuery1.SQL.Add('A.ANIMALDOB BETWEEN ''' + DateToStr(DTPBeg.Date) + '''
AND ''' + DateToStr(DTPEnd.Date) + ''' ');
This is not so simple.
It needs to be in the correct place in the SQL for IBOQuery1.
If there are already search criteria in a 'WHERE' clause, then I need to
first add 'AND'
Any easy way to get this done?
Can it be done with the IB_ Searchbar (ie. a between dates).
Any help will greatly be appreciated.
Thanks
Adrian
[Non-text portions of this message have been removed]
Helen previously helped me with the following line of code, and this was
just what I needed then.
IBOQuery1.AssignSQLWithSearch(IB_Query1);
This was needed, so that I could assign a search criteria to a IBOQuery for
use in a reporting tool (Report Builder).
I use the IB_Searchbar, and IB_Query1, with the necessary controls to select
fields etc.
This works fantastically, due to the line of code Helen helped with above.
Now I need to complicate matters more, by being able to search for a Date
between a start and end date, to further refine the search above.
So once I have searched for the necessary records. I assign the search:
IBOQuery1.AssignSQLWithSearch(IB_Query1);
But now I need to add:
IBOQuery1.SQL.Add('A.ANIMALDOB BETWEEN ''' + DateToStr(DTPBeg.Date) + '''
AND ''' + DateToStr(DTPEnd.Date) + ''' ');
This is not so simple.
It needs to be in the correct place in the SQL for IBOQuery1.
If there are already search criteria in a 'WHERE' clause, then I need to
first add 'AND'
Any easy way to get this done?
Can it be done with the IB_ Searchbar (ie. a between dates).
Any help will greatly be appreciated.
Thanks
Adrian
[Non-text portions of this message have been removed]