I have discovered another way to set the AutoNumber field to the value you want. This will work for a new table, beginning the first number with whatever you choose. And, it will work for an existing table that contains records so that the next new record will start at a specified field.
Here's a couple of rules before beginning:
- Make sure the NewValues Property for AutoNumber field
is set to --Increment--.
- No Primary Keys in either table...if there are,
Remove them until you have finished these steps.
- Original Table Properties:
Required - No
Indexed - Yes(Duplicates OK)
ValidationRule - Must allow Null values
(for fields or records)
1. Create a Temp. Table with a Number Field, Long Integer and use the same field name as in your original table.
2. In Datasheet view, enter a value one less than the number you want to start with in your original table. Ex. Temp. Table would be 99, if you want your original table to start with 100.
3. Create and run an Append Qry that appends the Temp table to the original table.
4. Delete the Temp Table.
5. Delete the record in your original table that the append query added.
When you add a new record to your original table, it will start with a value 1 greater than you gave in the Temp table.
If you compact your DB, AutoNumber for the next record will be reset to 1 more that the highest previous value. Therefore, before compacting, make sure to add at least one record to the table first.
In other words, if there are no values in the Table and you compact it, it will reset the value to 1. (one more than 0).
If the last record in your table was Number 50, then you Compact the DB, the next record will start with 51.
Hope this helps!
CindiN