foreign key

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

Forum home » Delegate support and help forum » Microsoft Access Training and help » Foreign Key

Foreign Key

resolvedResolved · Low Priority · Version 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:

Prefixed Autonumbering

When using Date Type = Autonumber as a primary key, clients may require autonumbering to be prefixed with a letter.

For example, P001, where P is the prefixed letter

Instructions
Step 1. Create Field Name
Step 2. Set Data Type to Autonumber
Step 3. Within Field Property General tabsheet,
enter Format property as [backslash]P000



View all Access hints and tips


Server loaded in 0.09 secs.