473,385 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cascading Combo box and Many to Many Relationship

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 9273
beacon
579 512MB
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 Expert 2GB
The second ComboBox.RowSource should be join of tables [Act] and [EntertainAct]. This could be easily filtered by EntertainAct.EntID field.

Regards,
Fish
May 7 '09 #3
OldBirdman
675 512MB
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 Expert 8TB
@20028431
Along FishVal's Trend of Thought in Post #3 only a little more unnecessarily complicated, which I always seem to do:
  1. cboEntertainment
    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 cboEntertainment
    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
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,556 Expert Mod 16PB
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
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,556 Expert Mod 16PB
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
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...
0
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 ...
6
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...
4
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...
1
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...
7
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
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...
3
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.