Specifically formatted auto increment primary key

R

Richard

Hi

I'm a beginner to Access. I'm in the process of importing
over a existing database from Excel to Access but don't
know how to set up the table so that my primary key is
auto incremented according to our existing format which is
alphanumeric i.e. A000, A001, A002...A999, B000, B001...
A work mate showed me the input mask but this doesn't auto
increment.

Help and thanks is advance.
Richard
 
M

MacDermott

Access offers AutoNumber fields, which are intended to supply unique
identifiers for each record.
They are not intended to assure that these numbers will be sequential, only
that they will be unique.
If you need these numbers to be meaningful, it is not wise to use the
built-in AutoNumber option.

You can code a function in VBA which will return the correct new primary
key, but since you haven't indicated how you know whether to use an A or a
B, you haven't given enough information for anyone here to write it.

HTH
- Turtle
 
V

Van T. Dinh

If you want to use this numbering scheme, you need to ensure that ALL data
entries are done via Forms and NOT directly in the DatasheetView of the
Table.

Using Forms, you can find out the "highest" number used and then increment
to the next number and allocate the new number to the new Record.

Personally, I avoid this sort of numbering as they often create unnecessary
problems. For one thing, you are restricted to 26,000 Records and what
would you do when you reach Z999?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top