View Single Post
  #2  
Old March 27th, 2010, 10:13 PM posted to microsoft.public.access.tablesdbdesign
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default many-to-many table setup?

Kathy,

The answer is in your sentence, "An individual can choose none, one, or more
than one of those options."

When there are one or more of something, you have a one-to-many
relationship. When you have a one-to-many relationship, you always need a
table on the many side. So you need a new table to record the options each
individual chooses for each event. Backing up a second, first you need a
table to record what the options a
TblOption
OptionID
Option

You can always add more options to TblOption in the future!

You record the events each individual attends in TblAttendance. When you
look at a record for any AttendID, you know who the individual is and which
event he attended. So to record the options each individual chooses for
each event, you need a new table and one of the fields needs to be AttendID:
TblChosenOption
ChosenOptionID
AttendID
OptionID

So for data entry, you could use a main form with a subform that contains a
subform. The main form would be based on TblEvent. The subform would be
based on TblAttendance. Set the Linkmaster property to EventID and set the
Linkchild property to AtEventID. For the subform contained in this subform,
base the subform on TblChosenOption. Set the LinkMaster property to AttendID
and set the LinkChild property to AttendID. You will need to Google to find
how to set this up if you want the subform to be continuous.

Steve



"Kathy R." wrote in message
...
I am having trouble figuring out how to set up tables/fields for the
following problem. Can someone please point me in the right direction?

I currently have three tables:

tblIndividual
IndID
FirstName
LastName

tblAttendance (join table between the other two)
AttendID
AtIndID
AtEventID

tblEvent
EventID
EventName
other event info

I have been asked to include a field which would keep track of options
each individual chooses for each event. Currently there are three options
(receive newsletter, receive a call, join), but I can envision adding more
in the future. An individual can choose none, one, or more than one of
those options.

I was thinking that I should add another foreign key to tblAttendance, and
a new table of event options. But I just can't seem to picture how that
is going to work. Do I store all of the options chosen in one field?
That doesn't seem right either. As you can see, I am just getting more
confused.

Once I get the tables set up correctly, how do I set up the form so that I
can easily choose the options? I suspect that I will be able to figure
this out easily once I see the table set up, but thought I'd ask in
advance.

I really appreciate any help you can give me.

Kathy R.