I'm using D5 and Advantage TDataset 6.2. I have created my own
"autoincrement" field in a table and have created a primary index based on
it and set the index of the table to Primary.
When I insert a new record I choose a value for the Item (i.e. psuedo
Autoincrement field - actually a double) between the current and previous
records (actually I use 0.5 less than the current value) and then add the
value in the "OnNewRecord" event of the table.
This works fine up to this point but then I try to "reorder" the Item field
Counter := 1
While not Table.EOF do
Item.Value := Counter
Counter :=Counter + 1
Table Next
(I've obviously paraphrased this)
Then the record pointer jumps all over the place (as evidenced by tracing
Recno in the Watch window) with the result that the Items field is not
properly "reindexed".
It would appear that the Primary Index is somehow lost somewhere between On
New Record and the "renumber" procedure.
I have tried to use Post and Refresh after adding the new record but to no

The reason I use the "Item Number" as an index is that I need the table to
remain unsorted on the following field (The program is for recipes and the
order of ingredients is specific).

Any suggestions appreciated as I'm nearing my wits end.