On 10/16/2023 4:10 PM, Charlie wrote: > Hi.. I am using autoincrement field type. Seems to work ok if I append from a table. But when I try to add using beginappend() instead of increasing the number in the field it goes back to 1. I tried alter table but couldn't get that to work either. I have the field indexed. Not sure if that could be causing the problem.
The problem is that the append command does not appear to be updating
the internal mechanic in the table that tracks the autoincrement number.
I think this is a known issue, but it's been a long time.
Simple solution (assumes you have the dUFLP set up): Determine what you
want the *next* entry to be (look at the last record, add 1). Write it
down.
In the Command Window, make sure all tables are closed:
close tables
set procedure to :dUFLP:DBF7File.CC
oDBF7File = new DBF7File( "your_table_name.dbf" ) // be sure to include
the extension
oDBF7File.SetNextAutoIncValue( new_value ) // this is the number I told
you to write down
oDBF7File = null
close procedure :dUFLP:DBF7File.cc