Subject Problem with FindFirst - endless loop
Author Kevin Stanton
The following code puts IBO into a loop, refetching data (the "Fetching
Query Results" window keeps restarting).

Any ideas will are greatly appreciated.

Win 2K
IBO V4.2.Gb
Borland IB 6.01



procedure TfrmOEList.btnFindClick(Sender: TObject);
var
UserResp : TModalResult;
Fld : String;
begin
frmOrderSearchOE := TfrmOrderSearchOE.Create(Application);
UserResp := frmOrderSearchOE.ShowModal;
SFld1 := frmOrderSearchOE.SearchFld1;
SFld2 := frmOrderSearchOE.SearchFld2;
SVal1 := frmOrderSearchOE.edtSearch1.Text;
SVal2 := frmOrderSearchOE.edtSearch2.Text;
frmOrderSearchOE.Release;

If UserResp <> mrOK then Exit;

with dmOEExp.qryOrderList do
begin
dmOEExp.qryOrderList.InvalidateSQL;
dmOEExp.qryOrderList.Refresh;

Filter := SFld1 + '=''' + SVal1 + '''';

If SVal2 <> '' then
Filter := Filter + ' and ' + SFld2 + '=''' + SVal2 + '''';

If NOT FindFirst then
begin
If SFld1 = 'CarPre' then
Fld := SFld2;
MessageDlg(Fld + ' is not found', mtInformation, [mbOK], 0);
end;
end;
end;