Yo lo veo mas sencillo tadavia...
Código Delphi
[-]
Var
YaWhere : Boolean;
Procedure AddWhere(condicion : String);
Begin
if YaWhere Then
Query1.SQL.Add('and ' + condicion)
else begin
Query1.SQL.Add('where ' + condicion);
YaWhere := True;
end;
End;
Begin
YaWhere := False;
Query1.SQL.Clear;
Query1.SQL.Add('Select * from tabla');
if combo1.Text <> 'todos' then
AddWhere('campo1 = ' + QuotedStr(combo1.Text));
if combo2.Text <> 'todos' then
AddWhere('campo1 = ' + QuotedStr(combo2.Text));
if combo3.Text <> 'todos' then
AddWhere('campo1 = ' + QuotedStr(combo3.Text));
if combo4.Text <> 'todos' then
AddWhere('campo1 = ' + QuotedStr(combo4.Text));
Query1.Open;
end;
Hasta luego.