Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number to Autonumber 1

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
I have a field that is Number, can I convert this to autonumber and start off from the max number in the field?

thanks
JE
 
DOESN'T ALLOW ME TO... DIDN'T KNOW IF THERE WAS A WORK AROUND...
 
Once you enter data in a table, you can't change the data type of any field to AutoNumber, even if you haven't yet added data to that field.

Add a new field to the table, and define its data type as AutoNumber. Microsoft Access then enters data in the AutoNumber field automatically, numbering the records consecutively starting with 1.
 
Hi,

Continuing from pkallas' suggestion, you can change the autonumber field's "seed" or beginning value (see Access Help under autonumber). However I think this will be rather a cumbersome arrangement programmatically.

Instead consider keeping the field as a number type. Then write a little function called from your form to increment the number each time a record is added. You can use a select query with the MAX aggregate function or DMAX to find the current highest value in the field.

If you are relying on the form's native navigation controls, then the increment function should be called from the form's BeforeInsert event.

CHeers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top