Hola:
Funciona perfectamente de la manera que me indicas. Me queda así.
Código Delphi
[-]
DM.IBDSAlumnos.Close;
DM.IBDSAlumnos.SelectSQL.Clear;
DM.IBDSAlumnos.SelectSQL.Add('select * from ALUMNOS');
if cbNivel.itemIndex=0 then
DM.IBDSAlumnos.SelectSQL.Add(' where NIVEL like ''%%''')
else
DM.IBDSAlumnos.SelectSQL.Add(' where NIVEL=:QUENIVEL');
if cbGrupo.itemIndex=0 then
DM.IBDSAlumnos.SelectSQL.Add(' and GRUPO like ''%%''')
else
DM.IBDSAlumnos.SelectSQL.Add(' and GRUPO=:QUEGRUPO');
if cbEtapa.itemIndex=0 then
DM.IBDSAlumnos.SelectSQL.Add(' and ETAPA like ''%%''')
else
DM.IBDSAlumnos.SelectSQL.Add(' and ETAPA=:QUEETAPA');
if cbNivel.itemIndex>0 then
DM.IBDSAlumnos.ParamByName('QUENIVEL').AsString := CBNivel.Text;
if cbGrupo.itemIndex>0 then
DM.IBDSAlumnos.ParamByName('QUEGRUPO').AsString := CBGrupo.Text;
if cbEtapa.itemIndex>0 then
DM.IBDSAlumnos.ParamByName('QUEETAPA').AsString := CBEtapa.Text;
DM.IBDSAlumnos.Open;
Muchas gracias.
Un saludo.