GeoffS Level: VB Lord

 Registered: 29-09-2004 Posts: 606
|
Re: special auto increment value
The "Autonumber" type in MS-Access is restricted to a whole integer starting at 1 and incrementing by 1. You cannot change this.
To implement a special identity number you will need to handle it manually. Create a table (NextIdentity) to store the next number to use. Whenever a new record is saved to your main table retrieve the value from the NextIdentity table, Increment the number by whatever criteria you choose and save it back to the NextIdentity table, then insert the retrieved id into the PrimaryKey field of your main table.
If your database is likely to be used in an environment where multiple users are adding lots of new records then you would be wise to check for the existence of the id in the main table before inserting it, just incase you have retrieved the NextIdentity before another user who has also retrieved that identity has saved the increment back.
____________________________
multi-tasking - the ability to hang more than one app. at the same time.
|
|