How do I relate 3 tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to connect 3 tables.

My main table is student information
The other tables are sports information & medical information

How do I relate them so when I open student information I can access
information from the other 2 tables
 
Presumably, your main table (StudentInformation) has a primary key. If it
does not it should. I recommend an autonumber field. Let's call it
StudentID for convenience.

Now in each of your other tables, you need to create a foreign key field.
It can also be called StudentID. Some people like to call it fkStudentID to
show that it is a foreign key. If StudentID is an Autonumber, fkStudentID
should be Long Integer. Otherwise they should be the same datatype. (BTW,
Autonumber IS a long integer with special properties.) Once you have
created these fields, you can relate the tables in the Relationship window.
Make sure you check the Enable Referential Integrity box. If you don't, you
don't really have a relationship.

Now for entering data, you'll probably want to create a Form/Subform setup
where the mainform is based on the StudentInformation table and each subform
will be based on the other two forms. To make it work properly, you have to
set the Link Parent/Child fields in the subform properties to the correct
PrimayKey/ForeignKey for the tables.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top