All pastes #251016 Raw Edit

Mine

public text v1 · immutable
#251016 ·published 2006-11-17 17:25 UTC
rendered paste body
adoqCustSearch.Active:=false;
IF EDsearch.Text = '' THEN
Showmessage('Please enter a search term!')
ELSE
BEGIN
IF CBsearch.Text = 'Surname' THEN
begin
  adoqCustSearch.SQL.Clear;
  adoqCustSearch.SQL.Add ('Select *');
  adoqCustSearch.SQL.Add ('FROM tblCustomers');
  adoqCustSearch.SQL.Add ('WHERE  ((tblCustomers.Surname)='''+(edsearch.Text)+''')');
end;
IF CBsearch.Text = 'Customer ID' THEN
begin
  adoqCustSearch.SQL.Clear;
  adoqCustSearch.SQL.Add ('Select *');
  adoqCustSearch.SQL.Add ('FROM tblCustomers');
  custid:=strtoint(EDsearch.Text);
  adoqCustSearch.SQL.Add ('WHERE  ((tblCustomers.CustomerID)=custid)');
end;
adoqCustSearch.Active:=true;

    IF adoqCustSearch.RecordCount >= 1 THEN
    begin
    count:=adoqCustSearch.RecordCount;
    LBresults.Caption:='Search for '''+ EDsearch.Text +''' returned '+ inttostr(count) +' results';
      IF adoqCustSearch.RecordCount > 1 THEN
      begin
        LBinfo.Caption:='To change customer use ''Next Customer'' and ''Previous Customer'' buttons';
        BTnextcust.Enabled:=true;
        BTprevcust.Enabled:=true;
      end
      else
      begin
        BTnextcust.Enabled:=false;
        BTprevcust.Enabled:=false;
      end
    end
    else
    begin
      count:=adoqCustSearch.RecordCount;
      LBresults.Caption:='Sorry, Search for '''+ EDsearch.Text +''' returned '+ inttostr(count) +' results';
      BTnextcust.Enabled:=false;
      BTprevcust.Enabled:=false;
    end;
END;
end;