Procedure Tfrmcns.btpesqClick(Sender: TObject); var
a:string; begin if edtpesq.Text ='' then begin
showmessage('Digite no campo ao lado da sua seleção'+#13+'o que voçê quer pesquisar!');
exit; end else
a:='select * from tabela '; case combo.ItemIndex of
0:a:=a+' where upper(Codigo)like upper('+quotedstr(edtpesq.text+'%')+')';
1:a:=a+' where upper(Kardex)like upper('+quotedstr(edtpesq.text+'%')+')';
2:a:=a+' where upper(Nome)like upper('+quotedstr(edtpesq.text+'%')+')'; end; with dm.sqltbtabela do begin
close;
sql.Clear;
sql.Add(a);
open; end;
edtpesq.Text :='';
combo.Text :='';
btdesenho.Enabled :=true; if dm.sqltbtabela.RecordCount = 0 then
showmessage('Nenhum registro encontrado na Base de Dados!');
edtpesq.Text :='';
combo.Text :=''; end;