不會吧,應該是你輸入完那個字段的數據,保存后才能求和。
要寫語句實現。
procedure TForm1.Table1AfterPost(DataSet: TDataSet);
var count:double;
bookmark1:tbookmark;
begin
count:=0;
try
Table1.DisableControls;
Bookmark1:=table1.GetBookmark;
Table1.First;
While Not Table1.Eofdo
begin
count:=Count+Table1.fieldbyname('Field1').AsFloat;
Table1.Next;
end;
Label1.Caption:='合計:'+Floattostr(count);
finally
Table1.GotoBookmark(Bookmark1);
Table1.FreeBookmark(Bookmark1);
Table1.EnableControls;
end;
end;