Good Morning Everyone,
I'm making a database and I'm playing with it using test data. When
I want to put the actual data in, how do I reset the autonumber back to
1? How do I tell the database to completely delete the fake records so
the autonumber doesn't start at, o, 50?
Thanks!
Jillian
Douglas J. Steele - 21 Jul 2006 23:06 GMT
Once you've deleted all the data, compact the database.
Having said that, though, why do you care? Autonumbers exist for one
purpose: to provide a (practically guaranteed) unique value that can be used
as a primary key. That purpose is met just as easily by 50, 51, 54 as by 1,
2, 3. Meaning should never be assigned to the value of autonumber fields. In
fact, usually you don't even show their values to the user.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Good Morning Everyone,
>
[quoted text clipped - 5 lines]
> Thanks!
> Jillian
René François - 31 Jul 2006 11:25 GMT
Douglas is right (as usual, of course!). However, if you really want to
reset the autonumber to 1 here's a way to do it:
1) Edit the table definition and change the autonumber field from Autonumber
to Numeric (Long Integer) and save the table.
2) Open the table (as I can undurstand it should be empty as you deleted all
the test data).
3) Compact the database and reopen it.
4) Edit the table definition again and revert the previously modified field
to Autonumber.
Once more, you should not assing any particular meaning to an autonumber
field. If you need a continuous numbering of records you should implement it
by yourself through a function.Try something like this:
Function GetNextNumber as Long
dim lngReturnValue as long
'
' Number is the name of the column containing the sequancial numbers
' MyTable is the name of the table you're working with
'
lngReturnValue = (DMax("Number", "Mytable") + 1)
GetNextNumber=lngReturnValue
End Function
> Good Morning Everyone,
>
[quoted text clipped - 5 lines]
> Thanks!
> Jillian