Unique ID with Autonumber

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm not a developer but a general user without knowledge on access programming.
I'm currently working on a project with tables having different ID.
How can I use the autonumber function to create different IDs such as "L0001" or "D0001" with L and D putting in front of an autonumber representing different ID fields.

Please help.

Thx.
 
Ray,

Don't! The number created by an Autonumber datatype is system-generated, and
is not meant for human consumption. It's realy only there to provide an
incrementing surrogate key for tables. If you want something that has
meaning to humans, create and manage your own.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


Ray said:
Hello,

I'm not a developer but a general user without knowledge on access programming.
I'm currently working on a project with tables having different ID.
How can I use the autonumber function to create different IDs such as
"L0001" or "D0001" with L and D putting in front of an autonumber
representing different ID fields.
 
Ray said:
Hello,

I'm not a developer but a general user without knowledge on access
programming.
I'm currently working on a project with tables having different ID.
How can I use the autonumber function to create different IDs such as
"L0001" or "D0001" with L and D putting in front of an autonumber
representing different ID fields.

Please help.

Thx.

First don't use autonumbers if you expect them to have any meaning to
people. They are machine numbers only.

I am not sure what you want, but keep in mind that L001 is not a number
it is text and text does not increment. You can create two fields one with
the letter and one with the number and make them look like they are one
field. You can make one text field and put numbers and letters in it, but
then increment does not mean anything.

Maybe if you explain what you really want the database to do, not the
way you want it to do it, that would be better. Tell us why you want the
L001 format and where the data comes from. Will there be duplicates of the
letter part? Will there be duplicates of the number part, will there be
duplicates of the combined parts? Does one the other, or the combination
need to be unique and or match existing letter or numbers?
 
I have done the same sort of thing where different copies of the same
database have been installed (in different locations) with the plan in mind
to combine the data down the road. So in each copy of the system the
primary key in a table is an autonumber with a prefix specific to that copy
(location).

Since Access autonumbers don't allow for characters it is best to make the
primary key based on two fields, one an autonumber and the other a constant
prefix that is different for each situation.

Doug M

Ray said:
Hello,

I'm not a developer but a general user without knowledge on access programming.
I'm currently working on a project with tables having different ID.
How can I use the autonumber function to create different IDs such as
"L0001" or "D0001" with L and D putting in front of an autonumber
representing different ID fields.
 
Back
Top