-
Feb 20th, 2010, 08:16 AM
#1
Thread Starter
Member
[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?
-
Feb 20th, 2010, 08:19 AM
#2
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.
-
Feb 20th, 2010, 08:33 AM
#3
Thread Starter
Member
Re: How Reliable is Autonumber In Access?
hack, I understood you. You're right! So the final judgement is I can go ahead with Autonumber 4 any no. of records. Right?
-
Feb 20th, 2010, 09:01 AM
#4
Re: [RESOLVED] How Reliable is Autonumber In Access?
The final decision is in your hands, not mine.
If it makes sense to you, then go for it. If it doesn't look like it will work for you, then explore alternatives.
-
Feb 20th, 2010, 09:06 AM
#5
Thread Starter
Member
Re: [RESOLVED] How Reliable is Autonumber In Access?
hack my dear, it certainly does make sense to me. I was just concerned about the long-term reliability of using Autonumber. Since you've loads of experience I trust you.
-
Feb 20th, 2010, 01:21 PM
#6
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|