A la misma consulta también puedes trabajarla así:
Código SQL
[-]
var Condicion: String;
...
with Query do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM Tabla');
SQL.Add('WHERE Campo = :x');
// 3 es un ejemplo y podría ser tomado de un componente TEdit
ParamByName('x').AsInteger = 3;
// Si tienes condiciones opcionales, también podrías preguntar
if Condicion = 'Cumple' then
begin
SQL.Add('AND CampoY = :y');
// 1974 también podría ser tomado de otro componente
ParamByName('y').AsInteger = 1974;
end;
Open;
end;
Saludos