Ver Mensaje Individual
  #3  
Antiguo 19-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
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.

Se me pasó por alto que quizá estés trabajando con TQuery.

En ese caso sería:
Código Delphi [-]
const
   MASTDET_OFF =  'SELECT * FROM DETALLE';
   MASTDET_ON =   'SELECT * FROM DETALLE WHERE "DETALLE"."MASTER_FIELD" = :"MASTER_FIELD"';

{ Form.OnCreate }
procedure TForm.FormCreate(Sender: TObject);
begin
  with QryMaestro do
  begin
    SQL.Text:= 'SELECT * FROM MAESTRO';
    Open;
    SQL.Text:= MASTDET_OFF;
    Open;
  end;
end;

{ DBLookupComboBox.OnCloseUP }
procedure TForm.DBLookupComboBoxCloseUp(Sender: TObject);
begin
  with QryDetalle do
  begin
    SQL.Text:= MASTDET_OFF;
    Open;
  end;
end;

{ DBLookupComboBox.OnDropDown }
procedure TForm.DBLookupComboBoxDropDown(Sender: TObject);
begin
  with QryDetalle do
  begin
    SQL.Text:= MASTDET_ON;
    Open;
  end;
end;

Nota:
.- Relacioná la propiedad: QryDetalle.DataSource con el TDataSource asociado al QryMaestro. (QryDetalle.DataSource -> dsMaestro)
.- MASTER_FIELD sería el nombre del campo por el que estableces la relación.

Saludos.

Última edición por ecfisa fecha: 19-08-2010 a las 07:15:43.
Responder Con Cita