podrías mirar de hacer algo así
Código Delphi
[-]
begin
Query.Close;
Query.SQL.Clear;
Query.SQL.Add('select * from tabla');
if Trim(Edit1.Text) <> '' then
Query.SQL.Add('where nombre like ' + QuotedStr('%' + Trim(Edit1.Text) + '%') );
try
Query.Open;
except
on E: Exception do
Application.MessageBox(PChar('Error abriendo Query. Mensaje:'#13+E.Message),
'Atención', MB_APPLMODAL or MB_ICONWARNING or MB_OK);
end;
Espero te sirva