Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

foreign key

ResolvedVersion 2003

Elizabeth has attended:
Access Introduction course
Access Advanced course
Access Intermediate course

Foreign Key

Please can you tell me how to set a foreign key or copy primary keys from one object to another?

RE: Foreign Key

Dear Liz

Thank you for attending Access Introduction course. I hope you enjoyed the course and benefited from it.

It is best to design your tables along with their fields on a piece of paper.

Please find attached word doc for reference. You don't copy primary keys from one table to another and assign it as a foreign key.

First of all you have to analyse the type of relationship the two tables should have. In the example on the uploaded file you can see that ONE Dept. can have MANY Employees. BUT ONE employee can only be in ONE dept. at one time. so, therefore they will have a One - to - Many relationship.

There will be a a foreign key in the Employees table which will help to link the two tables. That foreign key will be the Dept. Code in the Employees table.

I beleive you are enrolled for Access Intermediate on 7 Oct and you will be covering this more in details in addition to other types of relationships.

I hope this answers your query. Please mark this post as resolved if you are satisfied with the answer.

Many thanks


Kindest Regards

Rajeev Rawat
MOS Master Instructor 2000/2003
MCAS Master Instructor 2007

Attached files...

Designing tables.doc

Access tip:

Random sampling

Data is th key to a good database, therefore checking is essential.

A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])

2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.

4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.