B
betwalk
Hi everybody-
Let's see if I can ask this as simply as possible.
Tables in an existing system:
tblContacts
----------------
ContactID=pk
assorted fields like fname, Lname, etc.
tblChildren
---------------
ChildID=pk
ContactID=fk
assorted fields like fname, age etc.
tblDogs (this table is new)
---------------------
DogID=pk
assorted fields like DogName, breed, etc.
tblJoin (this table is also new)
----------
JoinID=pk
DogID=fk
contactID=fk
This is being used by an organization that trains service dogs.
Orginally this database just tracked donors and their family info (yes,
there is a separate table for donations...) They've asked me to help
them expand it to include tracking information about dogs, now, as
well. The purpose of the join table is to help link the various people
who come through these dogs' lives until they are placed with a client.
(ie: breeder, donor, puppy raiser, trainer, etc.) Some people are
adults and sometimes a participant is a student trainer, coming from
the children table.
I got everything set up beautifully and working very well, until I
remembered the kids. I forgot the kids and had only set up
relationship between the dogs and the tblContacts. My heart sank!
I'm confused about how to structure the join table so that I can have a
many-to-many relationship between the dogs and ALL the possible people,
not just the adults. Can I add ChildID as a foreign key to the
tblJoin, allowing a possible many-to-many relationship between dogs and
children? But then relationship rules would constantly be broken, since
either ContactID or ChildID would have to be left empty each time a
record is entered to this table.
Is there some way for me to combine tblContacts and tblChildren and
then set up the many-to-many relationship between tblDogs and this new
dataset?
I'm kinda stumbling around here. I'd be grateful for any guidance on
this-
Thanks- Betsy
Let's see if I can ask this as simply as possible.
Tables in an existing system:
tblContacts
----------------
ContactID=pk
assorted fields like fname, Lname, etc.
tblChildren
---------------
ChildID=pk
ContactID=fk
assorted fields like fname, age etc.
tblDogs (this table is new)
---------------------
DogID=pk
assorted fields like DogName, breed, etc.
tblJoin (this table is also new)
----------
JoinID=pk
DogID=fk
contactID=fk
This is being used by an organization that trains service dogs.
Orginally this database just tracked donors and their family info (yes,
there is a separate table for donations...) They've asked me to help
them expand it to include tracking information about dogs, now, as
well. The purpose of the join table is to help link the various people
who come through these dogs' lives until they are placed with a client.
(ie: breeder, donor, puppy raiser, trainer, etc.) Some people are
adults and sometimes a participant is a student trainer, coming from
the children table.
I got everything set up beautifully and working very well, until I
remembered the kids. I forgot the kids and had only set up
relationship between the dogs and the tblContacts. My heart sank!
I'm confused about how to structure the join table so that I can have a
many-to-many relationship between the dogs and ALL the possible people,
not just the adults. Can I add ChildID as a foreign key to the
tblJoin, allowing a possible many-to-many relationship between dogs and
children? But then relationship rules would constantly be broken, since
either ContactID or ChildID would have to be left empty each time a
record is entered to this table.
Is there some way for me to combine tblContacts and tblChildren and
then set up the many-to-many relationship between tblDogs and this new
dataset?
I'm kinda stumbling around here. I'd be grateful for any guidance on
this-
Thanks- Betsy