Creating an unique ID

  • Thread starter Thread starter rok2774
  • Start date Start date
R

rok2774

Guest
I am very new to db programing so please forgive for such a simple program.

Here is the deal. I have a db for about 500 students.

I would like the table [Students] to create a unique ID "number" for each student. I would like the number to be based on information from the same table. For example if the student's name is John Doe and his number is 555-1212 then I would like to the id to be JD1212. I plan on using more than name and phone number but this was just to show you, what i am trying to get done.

I can do this using a form and a calculated control, but I can't get the table and form to kiss and make up. I was also told you can't save data from a calculated control in a form to a table and it is gernerally not a good idea, so I was told.

Any help would be appreciated.

Sincerely,

Pastor Nick.
 
I also need help on this kind of problem-
I need to create a uniq code for each Name with following format

Name Code
Mekins M0001
Lorret L0001
Abso A0001
Anchor A0002

i.e. Unique codes shoul be (first letter of the name & 4 digit serial no of that letter)

Any help please?
 
It is really a VERY BAD idea to create keys out of pieces of data from other fields. What will you do if those pieces change. If the student's phone number changes for example?
I was also told you can't save data from a calculated control in a form to a table and it is gernerally not a good idea, so I was told.
Access doesn't save values from calculated controls. It only saves values from bound controls. That doesn't mean that you can't. However, it is such a poor idea, I'm going to let you figure out how (it is so simple you will wack your hand against your head when you figure it out) if you insist on doing it against all other advice.

When you don't have a unique candidate key or even two or three that in combination will make a unique primary key, an autonumber is the perfect solution. To facilitate searching, you can allow people to search on phone number, name, or what ever so they don't have to memorize their StudentIDs.

Compound keys of the type you're trying to create came about years ago when it was dificult to look up data. There is no reason in this day and age to use them especially since they violate first normal form, second normal forms, and third normal form. How's that for bad?
 
When you don't have a unique candidate key or even two or three that in combination will make a unique primary key, an autonumber is the perfect solution. To facilitate searching, you can allow people to search on phone number, name, or what ever so they don't have to memorize their StudentIDs.

Compound keys of the type you're trying to create came about years ago when it was dificult to look up data. There is no reason in this day and age to use them especially since they violate first normal form, second normal forms, and third normal form. How's that for bad?

Thanks for your help and advice. I have resigned the db to give everyone an auto number id...
 

Users who are viewing this thread

Back
Top Bottom