Ver Mensaje Individual
  #21  
Antiguo 27-04-2007
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.572
Reputación: 27
egostar Va camino a la fama
Veo que estas haciendo esto

Código Delphi [-]
If xxxxx then
else
  xxxx

No necesitas el else, en el primer bloque haces lo que necesitas, lo que faltaba es un table1.Refresh después del for, para que veas los cambios de inmediato en el DBGrid.

Así quedaría

Código Delphi [-]
procedure TForm1.BitBtn2Click(Sender: TObject);
var
  sQuery:String;
  I:Integer;
begin
  if DBGrid1.SelectedRows.Count > 0 begin
     with DBGrid1.DataSource.DataSet do begin
       for i := 0 to DBGrid1.SelectedRows.Count-1 do begin
           GotoBookmark(Pointer(DBGrid1.SelectedRows.Items[i]));
           sQuery:= 'Update Fecha_venc Set Fecha_venc= :fecha Where Docto  = :docto';
           Query1.SQL.Add(sQuery);
           Query1.ParamByName('docto').AsString   := Query1.FieldByName('docto').AsString;
           Query1.ParamByName('fecha').AsDateTime := Query1.FieldByName('Fecha_Apli').AsDateTime + StrtoInt(Edit4.Text);
           Query1.ExecSQL;
       end;
       Table1.Refresh;
     end;
  end;
end;

Lo del table1 lo puse porque no se con que estas ligando el DBGrid.

Salud OS.
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita