Ver Mensaje Individual
  #5  
Antiguo 06-09-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola de nuevo.

Para no dejarte así, sin nada te pongo una opción que dada la hora y el estado de mis neuronas, no creo sea la mejor.
Código Delphi [-]
...
  if (RadioGroup1.ItemIndex = -1)and(RadioGroup2.ItemIndex = -1) then
  begin
    MessageBox(Handle,'Al menos una opción debe estar seleccionada','',
      MB_ICONERROR+MB_OK);
    Exit;
  end;
  with ADOQuery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT * FROM A_CATALOGO WHERE ');
    if (RadioGroup1.ItemIndex <> -1) and (RadioGroup2.ItemIndex <> -1) then
      SQL.Add('AÑO = ' + QuotedStr(RadioGroup1.Items[RadioGroup1.ItemIndex])+
              ' AND MES = '+ QuotedStr(RadioGroup2.Items[RadioGroup2.ItemIndex]));
    if (RadioGroup1.ItemIndex <> -1) and (RadioGroup2.ItemIndex  = -1) then
      SQL.Add('AÑO = ' +  QuotedStr(RadioGroup1.Items[RadioGroup1.ItemIndex]));
    if (RadioGroup1.ItemIndex = -1) and (RadioGroup2.ItemIndex  <> -1) then
      SQL.Add('MES = ' +  QuotedStr(RadioGroup2.Items[RadioGroup2.ItemIndex]));
    Open;
  end;
  ...
El código sería más simple si por ejemplo se usaran Combobox.

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita