A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

many-to-many table setup?



 
 
Thread Tools Display Modes
  #1  
Old March 27th, 2010, 09:36 PM posted to microsoft.public.access.tablesdbdesign
Kathy R.[_3_]
external usenet poster
 
Posts: 25
Default many-to-many table setup?

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.
  #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.



  #3  
Old March 28th, 2010, 05:27 PM posted to microsoft.public.access.tablesdbdesign
Kathy R.[_3_]
external usenet poster
 
Posts: 25
Default many-to-many table setup?

Thank you Steve, that was the nudge in the right direction that I needed.

Kathy R.

Steve wrote:
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.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.