G
GeorgeAtkins
Design question:
When is it necessary to create a compound primary key in a child table? For
example. I am working on a database that records information about moms,
birth events, babies and home visits. Here is a brief view of two of the main
tables. Note that primary keys are noted using the following symbol: (*)
tblMOM tblBIRTHS
MomPK (*) BirthPK (*)
LastN MomFK
FirstN ChildDOB
Ethnicity Gestation
MOM has a 1:M relation with BIRTH via MomFK. But MomFK is not part of the
BIRTHS primary key. This design seems to work fine for data entry, queries
and reports.
Now I'll expand the design to a third table:
tblMOM tblBIRTHS tblVISITS
MomPK (*) BirthPK (*) VisPK (*)
LastN MomFK BirthFK
FirstN ChildDOB VisitType
Ethnicity Gestation Billed
BIRTHS has a 1:M relationship with VISITS, via BirthFK. BirthFK is not part
of the Visits primary key. But queries, reports, and even query-based edits
work fine.
One reason I ask this is that, if I made MomFK part of the BIRTHS primary
key, I'd be obliged to carry it into the VISITS table, as well. SO, it seemed
easier to keep it simple. BUT AM I MISSING SOMETHING? I note that I can even
edit data from these 3 tables in a query.
But, things go bad when I link in my 4th table, tblBABIES:
tblMOM tblBIRTHS tblVISITS tbBABIES
MomPK (*) BirthPK (*) VisPK (*) BabyPK (*)
LastN MomFK BirthFK
BirthFK
FirstN ChildDOB VisitType Gender
Ethnicity Gestation Billed DOB
BIRTHS has a 1:M relationship with BABIES, via the BirthFK field. Now, if I
try to create a query using all 4 tables, I can see results, but cannot edit
the dynaset; even when all fields are displayed!
The main objective: I am trying to create a dataset so I can build a data
entry form that matches the paper form the use for home visits. The fields in
the form are distribution in different tables in the system, so I thought it
I could use a single query datasource, I could avoid complications using
subforms.
What am I overlooking here?
Thanks, George
When is it necessary to create a compound primary key in a child table? For
example. I am working on a database that records information about moms,
birth events, babies and home visits. Here is a brief view of two of the main
tables. Note that primary keys are noted using the following symbol: (*)
tblMOM tblBIRTHS
MomPK (*) BirthPK (*)
LastN MomFK
FirstN ChildDOB
Ethnicity Gestation
MOM has a 1:M relation with BIRTH via MomFK. But MomFK is not part of the
BIRTHS primary key. This design seems to work fine for data entry, queries
and reports.
Now I'll expand the design to a third table:
tblMOM tblBIRTHS tblVISITS
MomPK (*) BirthPK (*) VisPK (*)
LastN MomFK BirthFK
FirstN ChildDOB VisitType
Ethnicity Gestation Billed
BIRTHS has a 1:M relationship with VISITS, via BirthFK. BirthFK is not part
of the Visits primary key. But queries, reports, and even query-based edits
work fine.
One reason I ask this is that, if I made MomFK part of the BIRTHS primary
key, I'd be obliged to carry it into the VISITS table, as well. SO, it seemed
easier to keep it simple. BUT AM I MISSING SOMETHING? I note that I can even
edit data from these 3 tables in a query.
But, things go bad when I link in my 4th table, tblBABIES:
tblMOM tblBIRTHS tblVISITS tbBABIES
MomPK (*) BirthPK (*) VisPK (*) BabyPK (*)
LastN MomFK BirthFK
BirthFK
FirstN ChildDOB VisitType Gender
Ethnicity Gestation Billed DOB
BIRTHS has a 1:M relationship with BABIES, via the BirthFK field. Now, if I
try to create a query using all 4 tables, I can see results, but cannot edit
the dynaset; even when all fields are displayed!
The main objective: I am trying to create a dataset so I can build a data
entry form that matches the paper form the use for home visits. The fields in
the form are distribution in different tables in the system, so I thought it
I could use a single query datasource, I could avoid complications using
subforms.
What am I overlooking here?
Thanks, George