View Single Post
  #5  
Old October 29th, 2008, 04:59 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Establish relationship between tables using TWO fields

On Tue, 28 Oct 2008 19:54:06 -0700, Ann Scharpf
wrote:

I have a ChildID table and a ClinicVisits table. I want to ensure that the
user cannot create a ClinicVisits record that does not have matching values
for ClinicID and ChildID in the ChildID table.

When I try to establish a relationship in the relationships table, it will
only allow me to set up a link for one field between the two tables. How do
I establish a two-field relationship between tables?


The relationships window can support up to TEN field joins.

Drag the ClinicID to the ClinicID, and the ChildID to the ChildID. Set the
enforcement on both join lines.

I've seen posts about foreign keys and junction tables but I don't quite
understand the foreign key posts and the junction table seems to be for
many-to-many relationships and I am setting up a one-to-many relationship.


Why is there a ClinicID field in the Child table, though? A clinic is not an
attribute of a person; could not the same child be seen at multiple clinics?
Your ClinicVisits table should (I would expect) have a single field
relationship to a table of Clinics (where did this visit occur) and,
separately, a relationship to a table of Children (who visited).
--

John W. Vinson [MVP]