sam said:
Hi,
First, I have to reapologizes for my poor English (both grammar
and
spelling).
When I delete a record in MS Access table that have autonumber field
and
add other record. The new one will have the number that follow the
one
that was deleted. So, when we look at the table (in effect) the
autonumber is skipping. Can we fix that? And how?
TIA
Sam
With SQL Server, you can use dbcc checkident to reset an identity field.
I am not sure what the equivalent command is in Access, however.
The question, however, is whether making the table in proper sequence is
worth both the performance hit and the possibility of error/corruption.
I would state a firm NO to both.
The idea behind autonumber/identity fields is they are derived keys,
which means they have no value to the user other than the fact that they
can look up a record with the key. They are meant to be used once. If
data is deleted, even immediately after inserted, the value is gone from
the list.
What it sounds like you would like is to make the recoreds look prettier
by avoiding holes in numbering. If this is really important to you, you
are probably NOT using the field as a derived key, but have attached
some human importance to the key. If so, you have an architectural
problem, as a derived key sequence should not matter to anyone.
BTW, I would be very wary of playing too much with Access, as it is
prone to corrupt.
Peace and Grace,
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
My vacation and childhood cancer awareness site:
http://www.crazycancertour.com
*******************************************
| Think outside the box! |
*******************************************