Relations Help

J

jamesb

I have a database that stores employee info. The EmployeeID Field (prim
key)is set at autonumber. (I don not have SSN's and some people are married
that work together, so ph# is not original either)The 2 databses I need to
link it to are Discipline and Sick leave. In both of the latter two
mentioned DB's, the primary key is EventID/EmployeeRefID set as prim key and
text. How can I relate these tables? Should I use a seperate linking table or
can I relate these as they are?? Maybe by adding another field!?! Help


J Bartel

PS I have had some great help on this site, but the rate and respond link
doesn't always work so thankyou to everyone in advance
 
D

Douglas J. Steele

If EmployeeRefID is text, you cannot link it to an AutoNumber field. You'll
have to change EmployeeRefID to a Long Integer instead.

Hopefully when you're talking about 2 databases, you actually mean two
tables. You cannot create relationships between tables if they do not exist
in the same database.
 
G

Graham Mandeno

Hi James

The data type for your foreign key in a relationship should be the same as
for the primary key. An AutoNumber is actually a special type of Long
integer, so that is the type your foreign key should be, not text.

Both your Discipline and SickLeave tables should have a numeric field (size
Long) named, say, EmployeeFK. Then add a relationship with referential
integrity between EmployeeID and EmployeeFK.
 

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