Ver Mensaje Individual
  #10  
Antiguo 10-06-2004
Avatar de cbrrr
cbrrr cbrrr is offline
Miembro
 
Registrado: jun 2004
Posts: 57
Reputación: 23
cbrrr Va por buen camino
Vale, ahora sí lo entiendo. Puedes hacer una cosa así:

En el AfterPost (que no BeforePost) puedes hacer.....

Código Delphi [-]
  procedure TForm1.Table1AfterPost(DataSet: TDataSet);
  var
    Q: TQuery;
  begin
    Q := TQuery.Create(Selft);
    Q.Database := 'la que sea';
    try
      Q.SQL.Text := 'select sum(Cantidad*Precunit) suma from TblDetproducto where Consumo = ' +
          Table1.FieldByName('IDConsumo ').AsString;
      Q.Open;
      if Q.IsEmpty then
        Table1.FieldByName('Totalfactu').AsFloat := 0
      else
        Table1.FieldByName('Totalfactu').AsFloat := Q.FieldByName('suma').AsFloat;
    finally
      FreeAndNil(Q);
    end;
  end;
Donde Table2 será tu tabla maestra

Espero que te sirva
__________________
Si no tienes algo que decir más importante que el silencio, cállate
Responder Con Cita