Autonumber an ID

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

Guest

I am new to Access and I am trying to automate my contact ID Number. I
currently have a code written that takes the first 3 letters of the last name
and the first 2 letters of the first name to create the ID. My question is
what happens when that creates duplicated ID's (my key field) and how can I
alter my code to add an automatic number to the end when a duplication would
occur? I am using Access 2002.
 
I am new to Access and I am trying to automate my contact ID Number. I
currently have a code written that takes the first 3 letters of the last name
and the first 2 letters of the first name to create the ID. My question is
what happens when that creates duplicated ID's (my key field) and how can I
alter my code to add an automatic number to the end when a duplication would
occur? I am using Access 2002.

The solution is... Don't do it this way.

This is called an "intelligent" key. That's unfortunately not a
compliment <g>. Creating a field out of pieces of other fields is
redundant, and does not achieve the benefit you seek: creating a
unique key. And even if it did, how could the user achieve any benefit
from seeing DAJOH1, DAJOH, and DAJOH3 and needing to know which one is
Darryl Johnson, which Darlene Johnston, and which Dagmar Johannsen?

I'd suggest that you use an Autonumber, guaranteed unique, and hide it
from the user's view altogether. Use the tools Access provides - combo
boxes and queries - to let them select "Dagmar Johannsen" "312 Main
St." from a dropdown list.


John W. Vinson[MVP]
 
Back
Top