Unique key by combine First & Last Name

G

Guest

I'm trying to create a database that consists of two tables; Employee and
UserError.
There are no employee ID's assigned and the person who will be entering the
data for the UserError table will only know each employee by their name.

I'm trying to create a unique key by combining the first and last name.
Once the employee's FirstName and lastName is enter, the third field called
FullName, will populate automatically when I enter the firstName and the
LastName

This way, the user who enters data from the UserError table can select from
the FullName Field to create a record.

Any help would be much appreciated.
 
R

Rick B

Well, you can combine the names to create a compound index, but you don't
need to put it in a new field.

In your table, just go to designview and Then select "Indexes" from the view
menu.

In the IndexName, enter something like "FullName". In the Field Name, enter
one of your two field names. On the next row, leave the Index Name blank
and select your second field in the Field Name. You can then set the Unique
Property to true.

But, I hope you don't end up with two employees with the same name. If I
were you, I'd use an employee ID number, or something unique like "phone
extension".
 
J

Jamie Collins

Rick said:
But, I hope you don't end up with two employees with the same name. If I
were you, I'd use an employee ID number

A better natural key might be (last_name, first_name, start_date) e.g.
might in reality be easier to differentiate two people based on who has
been with the organisation the longest rather than be expect to
remember (possibly meaningless) employee numbers.
or something unique like "phone extension"

Like uniquely identifying a car based on its current parking space <g>?


Jamie.

--
 
R

Rick B

Jamie: Good point on the extension thing, but some companies move the
extension with the person. My mom has had the same extension and dedicated
phone number for 20 years, but has moved offices many many times.

My company on the other had, sticks the extension to the desk (like you
parking example) but our second line moves with the person. So, personally,
I give the second line to family and the top line to clients that I don't
want calling me if my job duties change :)

Very good point though.
 
G

Guest

Thank you for replying to my question.

I tried your recomendation and created a fullname index in my employee
table. I've also created a table called error. There are only 2 fields,
Fullname and Error type. How do I link the FullName field in my errors table
and the fullname index in the employee table? I would also like to make it
so that the fullname field in the Error table is a drop down from the
Fullname index created in the Employee table.

In advance, thank you for your help.
 

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