Subject Searching Question
Author Bob
I have a form with a TComboBox which the user uses to select a Column to
search on, a TIB_SearchEdit to enter the parameters for the search, and a
TIB_Grid to display the results. I've modeled my code on the SearchingLinks
sample application.

The problem I am having is that when the program first runs, it displays the
entire dataset (properly) in the grid. When the user changes the ComboBox to
select a different col to search on, the grid clears and displays nothing
until the user types something in the SearchEdit box and presses enter. I
would prefer to display the entire dataset first, then let the user narrow
their choices (just like the SearchingLinks app does).

If, after changing their ComboBox selection, the user type a <space> in the
SearchEdit the entire dataset displays. But this is a hassle and I'm sure
it's unnecessary.

I have been up, down, left and right through my code and the properties of
the components, comparing them to SearchingLinks app, and I cannot figure
out why the grid shows up empty. Can anyone suggest where I should be
looking?? My code is below.

Bob Miszuk
==============
procedure TContractLookup.FormShow(Sender: TObject);
begin
ContLQuery.Prepare;
ContLQuery.Active := true;
end;

procedure TContractLookup.ContLQueryPrepareSQL(Sender: TIB_Statement);
begin
with ContLQuery do begin
case Abs( OrderingItemNo ) of
1: begin
SQLWhereItems.Add('CUSTOMERID STARTING WITH :CUSTOMERID');
StartingValue.ParamRefinePos := 0;
end;
2: begin
SQLWhereItems.Add('COMMODITY STARTING WITH :COMMODITY');
StartingValue.ParamRefinePos := 0;
end;
3: begin
SQLWhereItems.Add('MERCHANTID STARTING WITH :MERCHANTID');
StartingValue.ParamRefinePos := 0;
end;
end;
if ColComboBox.ItemIndex <> Abs( OrderingItemNo ) - 1 then
ColComboBox.ItemIndex := Abs( OrderingItemNo ) - 1;
end;
end;

procedure TContractLookup.ContLQueryOrderingChanged(
IB_Dataset: TIB_Dataset);
begin
ColComboBox.ItemIndex := Abs( ContLQuery.OrderingItemNo ) - 1;
StartingValue.AutoUpdate := true;
StartingValue.SetFocus;
end;

procedure TContractLookup.ContLQueryAfterPrepare(Sender: TIB_Statement);
begin
ContLQuery.GetOrderingItemsList( ColComboBox.Items );
end;

procedure TContractLookup.ColComboBoxChange(Sender: TObject);
begin
if ContLQuery.OrderingItemNo <> ColComboBox.ItemIndex + 1 then
ContLQuery.OrderingItemNo := ColComboBox.ItemIndex + 1;
end;