dbTalk Databases Forums  

many to many subform

comp.databases.ms-access comp.databases.ms-access


Discuss many to many subform in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
WhathaveIdone?
 
Posts: n/a

Default many to many subform - 05-20-2011 , 10:18 AM






Ok. I am creating an events db. I have tblEvents, tblAttendees; with
many to many relationship between the 2 tied through tblRegEvents. the
tblRegEvents has fields:RegEventsID, EventID, AttendeeID, Tuition. I
then have tblRegEventsPmts with fields: RegEventsID, Payment (a one to
many between tblRegEvents and tblRegEventsPmts).
I have my forms designed ok for Attendees and Events. Except that when
I try and track payments of each Attendees per event.
I was trying to do something like create a form with tblRegEvents.
That doesn't exaclty work the way I want it to. I was trying to show
the records for attendees while having a list of events available for
each attendee ( a listbox or something). Then a subform would have the
payments. Am I making this way too complicated? My problem comes when
trying to design the form to show only 1 attendee record. Also, in
filtering the listbox to show all the events(the way a subform would
do). If there are any thoughts on this, please let me know. I'm open
for a new approach as well as a solution to creating a form from my
Many to Many table. (It seems to me theoretically that should work,
but I know just enough about Access that if it starts to get
complicated, there is usually an easier way). I hope I have given
enough details and thanks for any tips.
-WhathaveIdone?

Reply With Quote
  #2  
Old   
Phil
 
Posts: n/a

Default Re: many to many subform - 05-22-2011 , 04:35 AM






On 20/05/2011 16:18:54, "WhathaveIdone?" wrote:
Quote:
Ok. I am creating an events db. I have tblEvents, tblAttendees; with
many to many relationship between the 2 tied through tblRegEvents. the
tblRegEvents has fields:RegEventsID, EventID, AttendeeID, Tuition. I
then have tblRegEventsPmts with fields: RegEventsID, Payment (a one to
many between tblRegEvents and tblRegEventsPmts).
I have my forms designed ok for Attendees and Events. Except that when
I try and track payments of each Attendees per event.
I was trying to do something like create a form with tblRegEvents.
That doesn't exaclty work the way I want it to. I was trying to show
the records for attendees while having a list of events available for
each attendee ( a listbox or something). Then a subform would have the
payments. Am I making this way too complicated? My problem comes when
trying to design the form to show only 1 attendee record. Also, in
filtering the listbox to show all the events(the way a subform would
do). If there are any thoughts on this, please let me know. I'm open
for a new approach as well as a solution to creating a form from my
Many to Many table. (It seems to me theoretically that should work,
but I know just enough about Access that if it starts to get
complicated, there is usually an easier way). I hope I have given
enough details and thanks for any tips.
-WhathaveIdone?

Try to get you started

Firstly I presume that you are allowing the possibility of more than 1
payment (part payments) for each event. Your table structure looks fine,
possibly If I were doing it I woldn't bother with RegEventsID, and the
Payment would have a triple key of AttendeeID, EventID and PaymenDate (to
prevent a payment inadvertanly being entered twice) So a main form for the
attendees will have a subform "SubEvents", showing the events picked (have a
combo box on the subform to pick the possible events) LinkMasterField
AttendeeID LinkChildField AttendeeID Then you have second subform to show the
payments. The LinkMasterField on this subform AttendeeID,
Forms!Attendees!SubEvents.Form!EventID The LinkChildField will be AttendeeID,
EventID

Phil

Reply With Quote
  #3  
Old   
WhathaveIdone?
 
Posts: n/a

Default Re: many to many subform - 05-23-2011 , 11:31 AM



On May 22, 3:35*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 20/05/2011 16:18:54, "WhathaveIdone?" wrote:









Ok. I am creating an events db. I have tblEvents, tblAttendees; with
many to many relationship between the 2 tied through tblRegEvents. the
tblRegEvents has fields:RegEventsID, EventID, AttendeeID, Tuition. I
then have tblRegEventsPmts with fields: RegEventsID, Payment (a one to
many between tblRegEvents and tblRegEventsPmts).
I have my forms designed ok for Attendees and Events. Except that when
I try and track payments of each Attendees per event.
I was trying to do something like create a form with tblRegEvents.
That doesn't exaclty work the way I want it to. I was trying to show
the records for attendees while having a list of events available for
each attendee ( a listbox or something). Then a subform would have the
payments. Am I making this way too complicated? My problem comes when
trying to design the form to show only 1 attendee record. Also, in
filtering the listbox to show all the events(the way a subform would
do). If there are any thoughts on this, please let me know. I'm open
for a new approach as well as a solution to creating a form from my
Many to Many table. (It seems to me theoretically that should work,
but I know just enough about Access that if it starts to get
complicated, there is usually an easier way). I hope I have given
enough details and thanks for any tips.
-WhathaveIdone?

Try to get you started

Firstly I presume that you are allowing the possibility of more than 1
payment (part payments) for each event. Your table structure looks fine,
possibly If I were doing it I woldn't bother with RegEventsID, and the
Payment would have a triple key of AttendeeID, EventID and PaymenDate (to
prevent a payment inadvertanly being entered twice) So a main form for the
attendees will have a subform "SubEvents", showing the events picked (have a
combo box on the subform to pick the possible events) LinkMasterField
AttendeeID LinkChildField AttendeeID Then you have second subform to showthe
payments. The LinkMasterField on this subform AttendeeID,
Forms!Attendees!SubEvents.Form!EventID The LinkChildField will be AttendeeID,
EventID

Phil
Phil,
First of all, yes, you are correct in that I do want to make available
more each Attendee to make multiple payments. This is great solution!
There is only one problem. It is possible for my Attendees to have
attended more than one event. Thats why I have the many to many
relationship set up between them.

This is the way I understood your response: What you're saying will
work if the second subform (let's call it RegPmts, and it is based on
tblRegEventsPmts) is a subform of subform: SubEvents. If I did that, I
would want to filter SubEvents.EventID to show only the Events that
the Attendee is attached to.(Probably by means of a list box)
Whichever event is selected in the listbox, might then be able to be
tied to the sub-subform: RegPmts. Thats where I run into problems.

Basically, what I'm saying is that, I tried the subform: SubEvents
with another subform: RegPmts which is linked to both the main form
and the other subform as you have indicated previously. this shows all
the events in SubEvents.EventID combobox.

Am I still missing something?

-WhathaveIdone?

Reply With Quote
  #4  
Old   
Phil
 
Posts: n/a

Default Re: many to many subform - 05-23-2011 , 12:04 PM



On 23/05/2011 17:31:37, "WhathaveIdone?" wrote:
Quote:
On May 22, 3:35*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
On 20/05/2011 16:18:54, "WhathaveIdone?" wrote:









Ok. I am creating an events db. I have tblEvents, tblAttendees; with
many to many relationship between the 2 tied through tblRegEvents. the
tblRegEvents has fields:RegEventsID, EventID, AttendeeID, Tuition. I
then have tblRegEventsPmts with fields: RegEventsID, Payment (a one to
many between tblRegEvents and tblRegEventsPmts).
I have my forms designed ok for Attendees and Events. Except that when
I try and track payments of each Attendees per event.
I was trying to do something like create a form with tblRegEvents.
That doesn't exaclty work the way I want it to. I was trying to show
the records for attendees while having a list of events available for
each attendee ( a listbox or something). Then a subform would have the
payments. Am I making this way too complicated? My problem comes when
trying to design the form to show only 1 attendee record. Also, in
filtering the listbox to show all the events(the way a subform would
do). If there are any thoughts on this, please let me know. I'm open
for a new approach as well as a solution to creating a form from my
Many to Many table. (It seems to me theoretically that should work,
but I know just enough about Access that if it starts to get
complicated, there is usually an easier way). I hope I have given
enough details and thanks for any tips.
-WhathaveIdone?

Try to get you started

Firstly I presume that you are allowing the possibility of more than 1
payment (part payments) for each event. Your table structure looks fine,
possibly If I were doing it I woldn't bother with RegEventsID, and the
Payment would have a triple key of AttendeeID, EventID and PaymenDate (to
prevent a payment inadvertanly being entered twice) So a main form for th
e
attendees will have a subform "SubEvents", showing the events picked (hav
e a
combo box on the subform to pick the possible events) LinkMasterField
AttendeeID LinkChildField AttendeeID Then you have second subform to show
the
payments. The LinkMasterField on this subform AttendeeID,
Forms!Attendees!SubEvents.Form!EventID The LinkChildField will be Attende
eID,
EventID

Phil

Phil,
First of all, yes, you are correct in that I do want to make available
more each Attendee to make multiple payments. This is great solution!
There is only one problem. It is possible for my Attendees to have
attended more than one event. Thats why I have the many to many
relationship set up between them.

This is the way I understood your response: What you're saying will
work if the second subform (let's call it RegPmts, and it is based on
tblRegEventsPmts) is a subform of subform: SubEvents. If I did that, I
would want to filter SubEvents.EventID to show only the Events that
the Attendee is attached to.(Probably by means of a list box)
Whichever event is selected in the listbox, might then be able to be
tied to the sub-subform: RegPmts. Thats where I run into problems.

Basically, what I'm saying is that, I tried the subform: SubEvents
with another subform: RegPmts which is linked to both the main form
and the other subform as you have indicated previously. this shows all
the events in SubEvents.EventID combobox.

Am I still missing something?

-WhathaveIdone?

No.

Both are subforms of the Attendee form.
What should happen as you click on each record of the SubEvents subform, the
appropriate payments for that event only should show up on the RegPmts
subform. You may need an event proceedure on the OnCurrent of the SubEvents
subform which says Me.Parent!RegPmts.Requery
Never got to the bottom of it, but sometimes it seems to work without the
OnCurrent Event, sometimes it seems to need it.

The Me.Parent refers back to the main Attendee for.

Phil

Reply With Quote
  #5  
Old   
WhathaveIdone?
 
Posts: n/a

Default Re: many to many subform - 05-23-2011 , 03:18 PM



On May 23, 11:04*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 23/05/2011 17:31:37, "WhathaveIdone?" wrote:









On May 22, 3:35*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
On 20/05/2011 16:18:54, "WhathaveIdone?" wrote:

Ok. I am creating an events db. I have tblEvents, tblAttendees; with
many to many relationship between the 2 tied through tblRegEvents. the
tblRegEvents has fields:RegEventsID, EventID, AttendeeID, Tuition. I
then have tblRegEventsPmts with fields: RegEventsID, Payment (a one to
many between tblRegEvents and tblRegEventsPmts).
I have my forms designed ok for Attendees and Events. Except that when
I try and track payments of each Attendees per event.
I was trying to do something like create a form with tblRegEvents.
That doesn't exaclty work the way I want it to. I was trying to show
the records for attendees while having a list of events available for
each attendee ( a listbox or something). Then a subform would have the
payments. Am I making this way too complicated? My problem comes when
trying to design the form to show only 1 attendee record. Also, in
filtering the listbox to show all the events(the way a subform would
do). If there are any thoughts on this, please let me know. I'm open
for a new approach as well as a solution to creating a form from my
Many to Many table. (It seems to me theoretically that should work,
but I know just enough about Access that if it starts to get
complicated, there is usually an easier way). I hope I have given
enough details and thanks for any tips.
-WhathaveIdone?

Try to get you started

Firstly I presume that you are allowing the possibility of more than 1
payment (part payments) for each event. Your table structure looks fine,
possibly If I were doing it I woldn't bother with RegEventsID, and the
Payment would have a triple key of AttendeeID, EventID and PaymenDate (to
prevent a payment inadvertanly being entered twice) So a main form forth
e
attendees will have a subform "SubEvents", showing the events picked (hav
e a
combo box on the subform to pick the possible events) LinkMasterField
AttendeeID LinkChildField AttendeeID Then you have second subform to show
the
payments. The LinkMasterField on this subform AttendeeID,
Forms!Attendees!SubEvents.Form!EventID The LinkChildField will be Attende
eID,
EventID

Phil

Phil,
First of all, yes, you are correct in that I do want to make available
more each Attendee to make multiple payments. This is great solution!
There is only one problem. It is possible for my Attendees to have
attended more than one event. Thats why I have the many to many
relationship set up between them.

This is the way I understood your response: What you're saying will
work if the second subform (let's call it RegPmts, and it is based on
tblRegEventsPmts) is a subform of subform: SubEvents. If I did that, I
would want to filter SubEvents.EventID to show only the Events that
the Attendee is attached to.(Probably by means of a list box)
Whichever event is selected in the listbox, might then be able to be
tied to the sub-subform: RegPmts. Thats where I run into problems.

Basically, what I'm saying is that, I tried the subform: SubEvents
with another subform: RegPmts which is linked to both the main form
and the other subform as you have indicated previously. this shows all
the events in SubEvents.EventID combobox.

Am I still missing something?

-WhathaveIdone?

No.

Both are subforms of the Attendee form.
What should happen as you click on each record of the SubEvents subform, the
appropriate payments for that event only should show up on the RegPmts
subform. You may need an event proceedure on the OnCurrent of the SubEvents
subform which says Me.Parent!RegPmts.Requery
Never got to the bottom of it, but sometimes it seems to work without the
OnCurrent Event, sometimes it seems to need it.

The Me.Parent refers back to the main Attendee for.

Phil
OK. So I was able to make it a LOT easier. What I did was I deleted my
first subform:SubEvents. I then created a listbox with the
tblRegEvents. I filtered the listbox by only allowing events where the
AttendeeID matched. Then I based my 2nd subform: SubPmts on both the
main form data as well as the data selected in the listbox. I added a
requery to the current event of the main form to requery the listbox,
then requery the subform. Also, the subform requeries On Click of the
listbox.

Thanks, Phil. This isn't exactly what you suggested, but I couldn't
have gotten it without your help.

-WhathaveIdone?

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.