Ver Mensaje Individual
  #6  
Antiguo 22-01-2008
Avatar de juanelo
juanelo juanelo is offline
Miembro
 
Registrado: sep 2007
Posts: 1.087
Reputación: 20
juanelo Va por buen camino
Que tal,
Tu error está en que primero borras y luego restas.

Código Delphi [-]
dsFactDetalle.DataSet.Delete;

Cuando haces lo anterior el cursor se mueve al registro anterior (que es el que tiene el valor 12).

Lo correcto sería:

Código Delphi [-]
 procedure TFFacturar.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if Key = VK_DELETE then
  begin      
    if ClientDataSet1.RecordCount > 0 then
    begin
       Total.Text := FLoatToStr(StrToFloat(Total.Text) - ClientDataSet1.Fields[9].AsInteger);
       dsFactDetalle.DataSet.Delete;    
    end;
    if ClientDataSet1.IsEmpty then
      begin
        Total.Text := '0.00';
      end;
  end;
end;

Saludos
Responder Con Cita