View Single Post
  #8  
Old October 29th, 2008, 06:06 AM posted to microsoft.public.access.tablesdbdesign
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Establish relationship between tables using TWO fields

Ann,
I think you are describing a clinic that exists in multiple places when you
say
"goes every two weeks to each site and sees the children at the clinic that
is
nearest to the child's village".

Each child belongs to one site? is this going to be the way it is?
What happens when a family moves to a different village - those children
will now be at a different site.

You could have a many to many relationship.
One table for sites.
One table for children.
One table that records which children are visited, at which site the visit
occurred and the date for each visit in this table.
The last table above is the junction table between sites and children.
If this fits your data, you have a many to one relationship between the
table for sites and the table for sites, visits and date.
You would then have a many to one relationship between the table for
children and the table for sites, visits and date.

Users would choose the name of the site for a particular visit on a
particular day.
Then they could choose the name of each child that is visited at that site
on that date.

However you are the best person to make the decision about how to manage the
data - as only you will know all the details.
My description is just a suggestion.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Ann Scharpf" wrote in message
...
John:

I must be doing something wrong. I link the ClinicID fields. Then, when
I
try to link the ChildID fields, I get an error that says:

A relationship already exists.
Do you want to edit the existing relationship? To create a new
relationship, click No.

If I click No, I get a ChildData_1 table added in the relationships. If I
click yes, I get a dialog box where I cannot access the ChildID field on
the
VisitData table.
--
Ann Scharpf


"John W. Vinson" wrote:


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]