A family of Microsoft relational database management systems designed for ease of use.
You cannot change a value in an autonumber column, but the values are really immaterial as they are solely to provide a distinct identifier per row and have no semantic relevance whatsoever. The only way to renumber them would be to delete the column from the table definition, save the table, and then add the column back to the table definition. It would then be assigned new numbers.
But if sequential numbering is important you should not use an autonumber, but compute the next number in sequence when a new row is inserted via a form. Roger Carlson has a simple solution for this, catering for both single and multi-user environments, at:
http://www.rogersaccesslibrary.com/forum/topic395.html
and there's a more complex one of mine, which allows for the next number to be used to be 'seeded' at any time at:
Unlike Roger's mine is not intended to guarantee sequential numbers, however, but only ordered numbers and operates in the same way as an autonumber in that if the insertion of a record is aborted the number will not be re-used for the next record.
I've also amended Roger's to allow numbers to be seeded, by changing his GetProductID() function in the product_2 form's module as follows:
Private Function GetProductID()
Dim lngProductID As Long
Dim lngSeedID As Long
lngProductID = Nz(Dmax("ProductID", "Product"), 0) + 1
lngSeedID = Nz(Dlookup("Seed", "Seeds"), 0)
If lngSeedID <= lngProductID Then
GetProductID = lngProductID
Else
GetProductID = lngSeedID
End If
End Function
This requires the addition of a one-row table, Seeds, to the database, with a single column, Seed, of long integer number data type. Enter a row with a zero value to start with. The number you wish to 'seed' is entered into this table, for which a simple form can be designed, setting its AllowAdditions and AllowDeletions properties to False (No) so that only the one existing row can be edited. To open this form I've added a button to the Product2 form with the following code in its Click event procedure:
DoCmd.OpenForm "frmSeeds", WindowMode:=acDialog
Me.ProductID.DefaultValue = """" & GetProductID & """"
This amendment to Roger's solution makes mine pretty much redundant. There could be some situations where mine is more bullet-proof, principally that the user will see the new number when they begin to insert the new record and it will not change, whereas with Roger's, if there is a conflict the number will change for any user who is not the first to save the record with the new number; but by and large Roger's solution, amended as above to allow seeding, will be fine and is a lot simpler to implement.
If you wanted you do this you'd first have to renumber the existing rows by removing and then replacing the column as described above. Then add another column of straightforward long integer number type and use an update query to fill this column with the values from the autonumber column. You could then remove the autonumber column, make the new column the primary key and use Roger's method to insert the next number when adding new records via a form.