473,757 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cascading Combo box and Many to Many Relationship

5 New Member
This is driving me mad!

I have been trying for 3 days now to work out how to do this with no success.

I have tables for Customer, Bookings, Entertainment, Act, Agent, and several others.
I have created a form to view existing bookings with Customer details as mainform and Bookings and Entertainment as subforms and this works fine.

I am trying to create forms to allow the booking clerk to enter a new Booking and am looking to have a Cascading Combo box for Entertainment Type (eg. Disco, Magician, Harpist etc) which upon selecting, offers the relevant Act Names in a second Combo Box.

I have built cascading combo boxes before but all have been based upon a one to many relationship - I just can't get my head round what I need to do for a many to many relationship.

The following 3 tables show details of table

Entertainment
EntID (PK) - autonumber
Type - text

Act
ActID (PK) - autonumber
ActName - text

EntertainAct
EntID - number
ActID - number


I am using Access 2007

Can someone please help before I smash my head against the wall!!!
May 7 '09 #1
8 9303
beacon
579 Contributor
Have you checked out the thread below? It really helped me out with cascading.

http://bytes.com/topic/access/insigh...mbo-list-boxes
May 7 '09 #2
FishVal
2,653 Recognized Expert Specialist
The second ComboBox.RowSou rce should be join of tables [Act] and [EntertainAct]. This could be easily filtered by EntertainAct.En tID field.

Regards,
Fish
May 7 '09 #3
OldBirdman
675 Contributor
This is the CLASSIC business model. Any Customer can buy any Service/Product/Act and any Act can be supplied to any Customer.. When you can't get your head around something, usually you haven't really defined your goal.
First, try NorthWind, supplied with Access (all versions, I think) for ideas.

Then take it step by step, maybe with paper and pencil (am I showing my age here?)
Customer calls booking clerk. What needs to be done first? Maybe bring up customer form? Verify that they are prior customer, all bills paid, addresses/phone #s up to date?

Customer will want an Act? By Entertainment or by Name? By either? He will want to know if available for some date or date-range? What do you want to see now? Possible Acts are those "Not Booked" and those should be filtered. From the available acts, you can generate the possible Entertainments.

Apparently Acts can be listed by multiple Entertainments. If you know the Acts that meet the original filter criteria, probably dates, then you build the necessary comboboxes.

Comboboxes dependent on prior choices don't always cascade. At least not in the usual sense. This can allow for some creative solutions.

These are just my thoughts, to get you thinking straight, not to supply specific answers.
May 7 '09 #4
ADezii
8,834 Recognized Expert Expert
@20028431
Along FishVal's Trend of Thought in Post #3 only a little more unnecessarily complicated, which I always seem to do:
  1. cboEntertainmen t
    1. Column Count = 2
    2. Column Widths = 0;1
    3. Bound Column = 1
    4. Row Source = "SELECT [Entertainment].[EntID], [Entertainment].[Type] FROM Entertainment; "
  2. cboArts
    1. Column Count = 3
    2. Column Widths = 0;0;1.5
    3. Bound Column = 1
    4. Row Source = None
  3. AfterUpdate() Event of cboEntertainmen t
    Expand|Select|Wrap|Line Numbers
    1. Private Sub cboEntertainment_AfterUpdate()
    2. Dim strSQL As String
    3.  
    4. strSQL = "SELECT Entertainment.EntID, Act.ActID, Act.ActName FROM Act INNER JOIN " & _
    5.          "(Entertainment INNER JOIN EntertainAct ON Entertainment.EntID = EntertainAct.EntID) " & _
    6.          "ON Act.ActID = EntertainAct.ActID WHERE Entertainment.EntID= " & Me![cboEntertainment].Column(0)
    7.  
    8. Me![cboActs].RowSource = strSQL
    9. Me![cboActs].SetFocus
    10. Me![cboActs].Dropdown
    11. End Sub
  4. We'll allow you to cheat and Download the Attachment
May 7 '09 #5
20028431
5 New Member
Many Thanks to you all - will follow your suggestions tomorrow and post back to let you know how I got on.
Once again many thanks
May 7 '09 #6
NeoPa
32,572 Recognized Expert Moderator MVP
Some excellent advice contained here.

I couldn't resist posting after reading ADezii's post. Priceless (in the nicest way of course) :D

To the OP - Welcome to Bytes!
May 7 '09 #7
20028431
5 New Member
Hi Guys

Just wanted to say a massive big thank your for all your responses but in particular to ADezii (I like unnecessary complication!!) .

I did download the zip file to see your example and then worked through the steps you oulined only to find that my initail problem was with my AfterUpdate SQL INNER JOIN coding duh!!!!!

Once again many thanks for your time.
May 8 '09 #8
NeoPa
32,572 Recognized Expert Moderator MVP
A pleasure dealing with you. It's always nice when a member posts back with thanks and an update.

Don't worry about the problem being somewhere else all along. That is so common, and just looking deeper into things often helps.
May 8 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3430
by: (Pete Cresswell) | last post by:
Seems like when there's a 1:1 relationship, the order of referential integrity enforcement depends on which way you drag the mouse pointer when drawing the relationship line. If you drag from tblObject to tblCollection, a tblObject record must exist before a tblCollection record can be created and if a tblObject record is deleted, a like-keyed rec in tblCollection will get the cascade delete. OTOH, if a record in tblCollection is...
0
2078
by: cognoscento | last post by:
I'm currently putting together a database for my work (not an expert by any stretch, so muddling through as best as I can... you know the story...) and I could use some advice and hand-holding I've got a subform with a series of cascading combo boxes (thanks to the Access tutorials on fontstuff.com) that let the user assign categories to items, in this case photos. This is being done to help constrain user selections and keep the...
6
1444
by: dBNovice | last post by:
Hello All, I have a DB that have 6 tables - tblCreator, tblSummary, tblPaper, tblProposition, tblContributor, tblPanel. The tables are linked in the following way: tblSummary is linked with tblProposition by ProposalID tblCreator is linked with tblProposition by ProposalID tblPanel is linked with tblPaper by PanelID tblPaper is linked with tblContributor by PaperID Their are two ways that a proposition is made: 1. A Creator proposes a...
4
64630
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one determines the available options in the other. TERMINOLOGY Row Source: The table/query from which the Combo Box or List Box gets its values. Note: There are other types of row sources that can be used but for simplicity we will stick with Tables...
1
1676
by: Kevin | last post by:
I need some help figuring this one out. I'm sure I did something like it awhile back but I can seemed to find that database or remember how I did this. Any way, the database tables are currently as follows...
7
2545
kcdoell
by: kcdoell | last post by:
I have three tables: One for the Division location: tblDivision DivisionID = Autonumber DivisionName = Text One for the Working Region: tblWrkRegion
1
2673
kcdoell
by: kcdoell | last post by:
Good Morning: I have a form where I am trying to create cascading combo boxes. I have done this before but I am getting the following error that is throwing me off: Procedure declaration does not match description of event or procedure having the same name. Basically have three tables: One for the Division location:
3
3988
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment list will 'display in the drop down list of CboSegment With Me! If IsNull(Me!cboDivision) Then
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.