AutoNumbered records change on compact???

G

Guest

If I have existing records in my table that uses an Autonumber to create
"record numbers", and some of the records have been deleted...therefore
leaving gaps in the numbering sequence...Will Access resequence or renumber
my existing records or leave them as previously assigned.... during a Compact
of the Database?
 
R

Rick Brandt

titlepusher said:
If I have existing records in my table that uses an Autonumber to
create "record numbers", and some of the records have been
deleted...therefore leaving gaps in the numbering sequence...Will
Access resequence or renumber my existing records or leave them as
previously assigned.... during a Compact of the Database?

Of course not.
 
G

Guest

Hi.

Those numbers will not change during a compaction. The gaps in the numbers
will remain, but the records themselves will be stored more efficiently after
the compaction. And no, you'll never actually see how the records have been
rearranged unless you use a hex editor to read the individual bytes in the
file. The database may be a faster loading and retrieving data, but that's
the only thing you'll notice as a user.

But you don't actually need these record numbers to be resequenced, do you?
If so, then you shouldn't use an AutoNumber type for this field, but a
user-defined function to create the next number for any new record to be
added to the table.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
J

Jeff Boyce

It sounds like you might be using Autonumbers as a user-visible value
(auditors can get fussy about "gaps in the numbering sequence"). If so,
remember that Access Autonumbers are intended to provide a unique row
identifier, but are not necessarily suitable for human consumption.

Besides, if your database had any dependent child tables, you wouldn't want
the "gaps" to be re-used -- that would cause the child records to be
"reassigned" to a totally different "parent"! (assumes you don't have
Cascading Delete set on Referential Integrity).
 
D

Dan

Keep in mind that if all of the records have been deleted Compact will cause
the autonumber field to start a 1 again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top