Have you traced?
Add a line like this
ShowMessage(IntToStr(Messages.RecNo));
But my suggestion is that you use the operation once, not on every calculation. Just to be sure. It' ssomehow innatural form me to calculate the current row basing onto previous rows.. (BTW: Some people say thet RecNo is very slow) If I were you I would create something like this.
AfterOpen event
Code: Select all
begin
DataSet.DisableControls;
while not DataSet.Eof do begin
DataSet.Edit;
DataSet.FieldByName('MessagesNo').AsInteger := DataSet.RecNo;
DataSet.Next;
end;
DataSet.DisableControls;
It's executed just once, so should be faster. ah, and MessagesNO shouldn't be calculated anymore.