Setting an autonumber back to zero

  • Thread starter Thread starter ARDZIZQ
  • Start date Start date
A

ARDZIZQ

I am working on a table with an autonumber field as primary key, now that is
ready I need to set theinitial value of the field to zero, how can I do dat
if I a on access 2007
 
You've asked "how".

I'll ask "why", as in "why do you care what value is in the autonumber
field?"

Access Autonumbers are designed to serve as unique row identifiers, and are
generally unfit for human consumption.

Are you displaying the Autonumber value to your users? Why? What does
knowing that number help them do?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thank you Jeff, It is just because I have being working with the table and
the number is around 300 now, as I will erase all the test data, the customer
wants to see the first number (I am displaying it on a report) as 1 in fact
when he starts using the table.
 
Thank you Jeff, It is just because I have being working with the table and
the number is around 300 now, as I will erase all the test data, the customer
wants to see the first number (I am displaying it on a report) as 1 in fact
when he starts using the table.

OK. Here is how.
Delete all of the data in the table (not the table itself).
Then Compact and Repair the database.
That should re-set the AutoNumber seed value back to 0.

However.... so what if the value starts at 301? Or 15893? Or -233948?
It's an internally used Access number used to guarantee a unique
record ID number only.
Hide the AutoNumber field. The customer need not ever see it. In the
future, as records are deleted, or record entry is interrupted, gaps
in the AutoNumber field are going to occur and those gaps cannot be
closed. Your customer is going to complain about missing records #35
and #78.
Hide the field. He won't see it and therefore won't complain about it.
 
As mentioned by Jeff and Fred (I mention it to make the point extra strong) -

Autonumbers are NOT intended for "human consumption." If you need a number
that a person will see then you should be creating it yourself. Autonumbers
provide a unique number for use as a key; nothing more. They are not
guaranteed to generate sequential numbers and if a record is started and then
canceled, the number is gone forever. Autonumbers, if set on random (and
sometimes when they aren't) will jump several, to several thousand, numbers
in the sequence and/or will generate negative numbers.

So, again - the customer should NOT be seeing the autonumber. It is just a
tool to ensure you have a unique key to work with.
--
Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP

Tutorials at http://www.btabdevelopment.com

__________________________________
 
Back
Top