Well... I could copy the data, and use that, but that would be very slow, and I would have to copy often and a lot. I have a table where records depends on another one. Still, it will be the backup if I can't solve this.
So every time I try to move the active record from inside the OnCalcField event I get a lot of some veird EOleException invalid argument error, even when I don't even read or write any data. I know, I must restore the dataset at the end of the event, as I do every time before EnableControls.
This is my event:
procedure TForm1.calc(DataSet: TDataSet); begin try Dataset.FieldByName('Calc').AsInteger:=10; if qwe then exit; qwe:=true; dataset.DisableControls; //dataset.next; //if not dataset.Eof then dataset.prior; dataset.EnableControls; ListBox1.AddItem(Dataset.FieldByName('SampleNum').AsString,nil); qwe:=false; except showmessage('This never shows!'); ADOQuery1.OnCalcFields:=nil; end; end;
When I try to uncomment the 2 lines it throws the errors, but I can't even catch it. If something handles the error, it couldn't become recursive because qwe prevents it. And I've already tryed with GotoBookmark and First, in case eof would cause this, but it's the same.
Also I can't find anything on google, so it would be nice if somebody could only show me a working example.