Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

AutoNumber reset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tflett - 23 Jul 2007 17:00 GMT
Does anyone know how to reset the autonumber back to 0 or 1??
Allen Browne - 23 Jul 2007 17:08 GMT
Delete all records.
Then compact the database (Tools | Database Utilities.)

If you need to reset it programmatically:
   http://allenbrowne.com/func-ADOX.html#ResetSeed

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Does anyone know how to reset the autonumber back to 0 or 1??
tflett - 23 Jul 2007 17:14 GMT
Thank you

> Delete all records.
> Then compact the database (Tools | Database Utilities.)
[quoted text clipped - 3 lines]
>
> > Does anyone know how to reset the autonumber back to 0 or 1??
Jeff Boyce - 23 Jul 2007 17:39 GMT
Allen provided pointers to "how to".

Now, ?why?  I'm not asking out of simple curiosity.  Frequently folks try to
use Access Autonumbers to mean something (e.g., "a sequence number", an
"invoice number", ...).

Access Autonumbers are intended to be used as unique row identifiers, and
are generally unfit for human consumption.  Why do you care what value the
autonumber is?

Regards

Jeff Boyce
Microsoft Office/Access MVP

> Does anyone know how to reset the autonumber back to 0 or 1??
tflett - 23 Jul 2007 17:46 GMT
After testing my DB, I would like to reset the autonumbers back to 1 when
entering new data.  My sutonumber is being used to keep track of clients in
the DB.

> Allen provided pointers to "how to".
>
[quoted text clipped - 12 lines]
>
> > Does anyone know how to reset the autonumber back to 0 or 1??
steveatdb - 23 Jul 2007 18:04 GMT
I would try using a different method to increment in this case to keep
everything in same order the problem with using autonumber for tracking
clients is that it can turn out to be random. You can not be certain that you
will be given numbers in order as in 1,2,3,4... it may jump from
4,5,6,8692003,7,8.

> After testing my DB, I would like to reset the autonumbers back to 1 when
> entering new data.  My sutonumber is being used to keep track of clients in
[quoted text clipped - 16 lines]
> >
> > > Does anyone know how to reset the autonumber back to 0 or 1??
Jeff Boyce - 23 Jul 2007 18:08 GMT
By "keep track of clients", do you mean count them?  Remember, Autonumbers
will (eventually) not be sequential, and can be (set to) random.

Do you mean "related a client in one table to that client's 'child' records
in another table"?  If so, does it matter if the ID is 1 or 191?

Regards

Jeff Boyce
Microsoft Office/Access MVP

> After testing my DB, I would like to reset the autonumbers back to 1 when
> entering new data.  My sutonumber is being used to keep track of clients
[quoted text clipped - 19 lines]
>>
>> > Does anyone know how to reset the autonumber back to 0 or 1??
tflett - 23 Jul 2007 18:22 GMT
I would like to count all the clients being entered in the db for percentages
purposes.  My autonumber is my PK and is being used to link other tables
together.  I guess it doesn't matter what the autonumber is.  So I take it
all other autonumbers in the db won't matter as long as the relationships are
correct?

> By "keep track of clients", do you mean count them?  Remember, Autonumbers
> will (eventually) not be sequential, and can be (set to) random.
[quoted text clipped - 30 lines]
> >>
> >> > Does anyone know how to reset the autonumber back to 0 or 1??
Jeff Boyce - 23 Jul 2007 20:19 GMT
If you have the relationships set (e.g., one-to-many, using a foreign key
field in the many side table that points back to the {?autonumber} primary
key in the one side table), it won't matter.

If you want a count of rows in ANY table, use a Totals query (or the
DCount() function).

That way, it won't matter how many gaps are in the Autonumber (primary key)
sequence (and there will be!), you can still count how many.

Regards

Jeff Boyce
Microsoft Office/Access MVP

>I would like to count all the clients being entered in the db for
>percentages
[quoted text clipped - 45 lines]
>> >>
>> >> > Does anyone know how to reset the autonumber back to 0 or 1??
John W. Vinson - 23 Jul 2007 20:20 GMT
>I would like to count all the clients being entered in the db for percentages
>purposes.

Then count them, using a Totals query.

The Autonumber is *NOT* a count, and should not be used as if it were!

            John W. Vinson [MVP]
John W. Vinson - 23 Jul 2007 19:04 GMT
>After testing my DB, I would like to reset the autonumbers back to 1 when
>entering new data.  My sutonumber is being used to keep track of clients in
>the DB.

What Jeff is saying is... let the autonumber keep track of clients, *behind
the scenes and under the hood*. Neither you nor your users should care whether
a client is number 3, or 318, or -225104225. The ONLY purpose of the
autonumber is to provide a unique key for linking tables within your
application; they're not suitable for human consumption.

            John W. Vinson [MVP]
Jeff Boyce - 23 Jul 2007 20:20 GMT
Thanks, John.  I was beginning to wonder if I was being too subtle...<g>.

Regards

Jeff Boyce
Microsoft Office/Access MVP

> On Mon, 23 Jul 2007 09:46:08 -0700, tflett
> <tflett@discussions.microsoft.com>
[quoted text clipped - 14 lines]
>
>             John W. Vinson [MVP]
tflett - 23 Jul 2007 20:34 GMT
Thanks for the Info guys you were both extremely helpful.

> Thanks, John.  I was beginning to wonder if I was being too subtle...<g>.
>
[quoted text clipped - 21 lines]
> >
> >             John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.