I have a TDBGrid, TDataSource and TTable on a form. I created a Paradox
table with DataBase Desktop. The table has three fields. I set field, a
numeric field, to be a key field that I want to set from calculated data.
The key field is not displayed in the grid - I am just using it to keep the
data sorted in the grid. The key field is used in a TChart however, but that
is working fine.
I am making the change in the BeforePost event handler. I have also tried
the LeaveColum and other event handlers and they all work the same with the
same problem. I have tried setting the field data with the SetFields method
and by accessing the fields directly; they both have the same problem.
Everything works fine when I insert a new record, but when I edit an
existing record I get a Record/Key Deleted error message. If I click OK on
the error message box the data posts OK and all is good. I just need to get
rid of the annoying error message.
If I remove the "key" attribute from field the error does not occur. But
then the data displayed in the grid is not sorted after post. Is there a
Sort method for tables? I cannot find it. If there is a Sort method I could
forget the key field and sort the table afterwards.
I cannot see what I am doing wrong here. Can anybody help?