Re: Making an autonumber field start at a set number
- From: salad <oil@xxxxxxxxxxx>
- Date: Mon, 30 Jul 2007 23:21:10 GMT
RASTUS wrote:
I am constructing an order number and a Job number based database and I want
the order numbers to automatically increment to the next number, I currently
have used a combined key to achieve this but don't know how to make both
parts of the key display on the form and don't know how to make the number
increment starting from a given number say 550000, can anyone help, possibly
I should not use the key field to achieve the desired effect?
Personally, I like autonumber for table keys. And with autonumbers I don't care if they are sequential. The reason? It is so easy to get out of sequence and have holes using autonumbers.
Try this. Open a table with an autonumber key field. Start entering some data then press ESC a couple of times to undo the changes and close the table. Open again and enter some data. The autonumber will increment but now there's a space.
What some folks do is get the max number of the table and add 1 to it to create a sequential number. Others may open a table that holds key numbers, add 1 to a key, update the table and save that number to the field.
You can still end up with "holes" with this method too. Let's say you create the key number when something is added to the record. Someone else adds a record 1 higher than yours. Then you escape out of the record.
You may find it best to create the number when the record is being added to the table to avoid holes. Or else create the number right away but if you don't want to save it, set a flag to ignore it.
.
- References:
- Making an autonumber field start at a set number
- From: RASTUS
- Making an autonumber field start at a set number
- Prev by Date: Re: Making an autonumber field start at a set number
- Next by Date: Re: OT: Missed the Boat on Import Logic
- Previous by thread: Re: Making an autonumber field start at a set number
- Next by thread: In MS Access how can I skip to the next page on section break if section can not be printed entirely
- Index(es):
Relevant Pages
|