I'm trying to achieve a autonumber with a text prefx I can build relationships between tables with eg INV00001 for invoice 00001 etc
You don't need to store the INV prefix or the leading zeros in the column. If you use an autonumber, then instead of showing the bound control in a form or report use an unbound control with a ControlSource property of:
="INV" & Format(InvoiceID,"00000")
However, as Tom points out, an autonumber does not guarantee sequential values, and you can't completely rule out the possibility of it arbitrarily inserting a value which exceeds the five digits. To avoid that, and provide sequential numbers, you'd use a
straightforward long integer number data type as the primary key InvoiceID, and compute its value when a row is inserted via a form. You'll find an example as CustomNumber.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
In this little demo file the 'Sequential Numbering' option illustrates this, and includes error handling to cater for conflicts where two or more users in multi-user environment are inserting a new row simultaneously. It also includes the facility to seed
the next number to be used, though that is probably not relevant in your case. Note that the primary key, ProductID in my demo, does need to have a control in the form bound to it, but this could be hidden by setting its Visible property to False (No) and
the formatted value shown in an unbound control
Whether you use an autonumber or compute the InvoiceID primary key, a foreign key in any referencing table would be a straightforward long integer number data type. As with the primary key this could be hidden and the formatted value displayed as described
above.