Not sure why you'd need to format it in a table. If you are exposing this to users, you can format the value in a form or report. But an autonumber field is always going to be a ... yep, number.
You can apply the Format function to it in a Query calculated field or VBA like:
Code:
Format([ID],"00000")
There shouldn't be any need to apply a custom format to it in the underlying table, as users should not be going directly in to the Table to access of view the data anyway.
That's right - for a number field. You should never need to format a field in a table, as Joe says above. You can format anything you want for the users in a form / report / query. I'd guess I'd ask why you feel like you need to format a field in a table?
+ think about whatever might happen when numbers get bigger than 99999 (if that is possible). Also, whether a number is 00001 or 99999 it's not a particularly pleasant format
EDIT I.e., if you get numbers gibber than 99999 with a format of "00000" I think they will still display correctly (probably as 100000, 1000001, ...). But why are you using a five character format is the question - and I assume the answer is that you expect numbers never to exceed five digits. And as stated above, pretty much you should not care about the format of a primary key autonumber field in a table because that's not something users should ever look at directly in a table itself. But if that format carries through to all your queries, forms and reports maybe you can make the case that it will be convenient.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.