Is there a way of converting an ID field in a table which is currently in "number" data type, to "autonumber". There are no duplicate numbers in this field at present. I would like access to add new autonumbers from the next new records onwards.
First, post Access questions in the Access forums. This has been answered hundreds of times. And you didn't specify which version you are working with.
You can't change Number to Autonumber. You can add another field with data type autonumber and it'll number the records.
Autonumber has it's problems - such as leaving skipped numbers when a record is deleted. Again, see the discussions of autonumber in the Access forums.
You can create your own autonumber field. Here's the main ways:
Let's say you want the numbering to begin with a different number other then 1. Let's say 57. Create your table with NO data and no primary key. Have a field called ID and make the data type Number. Save your table. Select your table, right click and select Copy. Then right click and select Paste. Give it a new table name and select Structure Only. Open up this new table and create one record with ID the starting number one less then the one you want, in this case 56. Close this table. Open the first table and now make the ID field an Autonumber type. Close the table. Create an append query from the second table appending the one record to the first table. Now open the first table and add another record. It will automatically be 57. Delete record number 56.
Let's say you want to create your own autonumber field. Create a table with a field called ID. Create a form for that table. On the form, go to design view and click on the text box of the ID field, and open the properties sheet. Click on Default value and enter:
=Dmax("[ID]","tablename")+1
Now when you go to the next new record, it will be incremented by 1.
Let's say you want an autonumbered field by Microsoft but want some characters in front of the number like mc001, mc002, etc. Go to design view, click on the autonumber field and in the Format box type "mc"00
This places mc next to 2 zeros and then tacks on the autonumber.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.