I am trying to copy data from table Orders to table Order_History. Both tables have a foreign key to Details and Detail_History.
We have an Ordernumber column in both orders tables and a corresponding Link_Ordernumber column in both details tables.
I tried this code:
tblorderhist.Insert;
tblorderhist.CopyFields(DataModule1.tblorders);
tblorderhist.Post;
tbldetailHist.Insert;
tbldetailHist.CopyFields(DataModule1.tblline);
tbldetailHist.Post;
and on the line
tblorderhist.CopyFields(DataModule1.tblorders);
Delphi throws the error
Project Prjdoors.exe raised exception class EDatabaseError with message 'Field 'orderno' cannot be modified'.