If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] How Reliable is Autonumber In Access?

In Ms Access, can I rely on using an Autonumber field to generate unique record-ids? I will be dealing with a record size of 500-5k. I ask coz there're few people who prefer to programatically generate the record-ids rather than rely on an Autonumber field. Somehow they're suspicious of the long-term viability of an Autonumber field. I do not know why! Any observations on this issue?

Re: How Reliable is Autonumber In Access?

Autonumber is reliable with respect to unique IDs...they will not be duplicated.

There is something to keep in mind however.

If you have 10 records numbered
1 2 3 4 5 6 7 8 9 10

and you delete record 3 and record 8 your next unique number will be 11. It will not reclaim the deleted numbers.

So, now you would have records numbered like this:
1 2 4 5 6 7 9 10

If that isn't a problem, then OK

I've always gotten around this by only allowing "soft" deletes...in other words, I set a flag in a field which my code interupts as a delete so that record never, ever shows up anywhere, but it maintains my consequtive record numbering (which auditors like) and it allows me the option of "undeleting" a record.

Re: [RESOLVED] How Reliable is Autonumber In Access?

I know this is marked as resolved, but I thought I'd chime in.

In terms of reliability (and your time to get it working), AutoNumber is the better option.

I've seen several people make attempts at creating their own version, and in each case there has always been at least one situation where it failed (or would have given enough time), such as multiple new records being created 'simultaneously' by different users.

There are a surprising number of situations that need to be thought of carefully before creating something like that, and it has already been done properly (and tested by millions of people) in AutoNumber.

As Hack posted, the downside to AutoNumber is the lack of consecutive numbering... but that is actually a good thing in terms of the database (as it means any 'orphan' data in other tables wont get linked to a new record). If you need consecutive numbering, I would recommend thinking of using another field for that purpose.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.