473,412 Members | 2,003 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,412 software developers and data experts.

Cascading 3 Combo Boxes, Produce data in Subforms

Hi

I am designing my first database. I'm trying to create cascading combo boxes in a form and display the data inside the subform. I have 3 combo boxes on the form. I'm trying to make them dependent on each other so by selecting one combo box updates the others in the series.

Diagrammatically the model is:

1. Context of Approval----<Type of Approval----<Risk Category
2. Produce data inside subform (Risk data).
3. ONE Risk can have many Risk Category and can belong with many Approval.

This my current table, just to clarify im using many to many type relationship.

Table:
Expand|Select|Wrap|Line Numbers
  1. Risk
  2.     ID_Risk  (PK)
  3.     Risk_Name
  4.     Date_Created
Expand|Select|Wrap|Line Numbers
  1. Type of Approval
  2.     ID_Approval_Type (PK)
  3.     Approval_Type_Name
  4.     Date_Created
Expand|Select|Wrap|Line Numbers
  1. Context of Approval
  2.     ID_Context_Approval (PK)
  3.     Context_Approval_Name
  4.     Date_Created
Expand|Select|Wrap|Line Numbers
  1. Risk Category
  2.     ID_Risk_Category (PK)
  3.     Category_Name
  4.     Date_Created
Join Table : called cross
Expand|Select|Wrap|Line Numbers
  1. Cross_Risk_Approval (between Risk & Approval)
  2.     ID_Risk (FK)
  3.     ID_Approval_Type (FK)
Expand|Select|Wrap|Line Numbers
  1. Cross_Context_Approval (between Type of Approval & Context of Approval)
  2.     ID_Approval_Type (FK)
  3.     ID_Context_Approval (FK)
Expand|Select|Wrap|Line Numbers
  1. Cross_Risk_Category (between Risk & Risk Category)
  2.     ID_Risk (FK)
  3.     ID_Risk_Category (FK)
Oct 30 '19 #1
4 1916
The first combo box is called CBO_CONTEXT, second CBO_APPROVAL and third CBO_CATEGORY. CBO_CONTEXT combo box has several data represent as mother grouping for CBO_APPROVAL, selecting a particular CONTEXT, should filter APPROVAL belonging only from the CONTEXT selected. Selecting a particular APPROVAL from the CBO_APPROVAL combo box filters the CATEGORY combo box.

Then there are subform below will produce a data (data inside table Risk) which will only produce data base on what has been selected on combo box previously. This is how it should behave.
Oct 30 '19 #2
So the position in the RELATIONSHIP is: "Refer the attachment"

"Context of Approval", "table cross", "Type of Approval", "table cross", "Risk", "table cross", "Risk Category"

Im not very familiar with access + just a basic knowledge of codes. Right now the way Im doing:

The way I make the form, main form is the Risk Category, for the SUBFORM, I make query base on table : "Refer the attachment"

“Cross_Risk_Approval”, “Risk”, “Cross_Risk_Category”, “Risk Category”.


After selecting Risk Name the column that I want to display. Base on query I create from

Form Wizard creating a sub-from Datasheet. After that I just drag and insert into the main form.

To make the combo box working. For combo box CBO_CONTEXT I just simply selected from combobox wizard, same goes for CBO_APPROVAL & CBO_CATEGORY. After that inside CBO_APPROVAL row source: "Refer the attachment"

"Cross_Context_Approval" & "Type of Approval"


Within the query under the table Cross_Context_Approval, column ID_Context_Approval inside criteria I enter " [Forms]![SubFrom]![ComboBox] ". Same method goes to Inside CBO_CATEGORY.


-The result is, after selecting CBO_CONTEXT then it will produce a specific CBO_APPROVAL data.
-Then after selecting from CBO_APPROVAL, it will produce a specific CBO_CATEGORY data.
-But after that inside the subform, it produce all data inside the CBO_CATEGORY but not filtering from CBO_APPROVAL.

Its not like what I'm trying to achive. "subform will produce a data (data inside table Risk) which will only produce data base on what has been selected on combo box previously" which is CBO_APPROVAL & CBO_CATEGORY.

Base on my search for this situation, they are more on one to one relationship or one to many, or only using one table. I trying my hard to understand the code givens out there.

Base on codes what I found and trying to tweak it all around. All the try and error I've been try it have been like a month or more.

I really really really appreciate all help that I can get. I also glad to share my datababase for you guys to look into it. I'm using Access 2013.
Attached Images
File Type: jpg Relationship.jpg (69.4 KB, 141 views)
File Type: jpg SubForm Query.jpg (119.2 KB, 192 views)
File Type: jpg CBO_APPROVAL row source.jpg (110.8 KB, 154 views)
File Type: jpg CBO_CATEGORY row source.jpg (104.8 KB, 109 views)
Oct 30 '19 #3
twinnyfo
3,653 Expert Mod 2GB
Michie999,

Welcome to Bytes!

I will offer a generic solution as a way to begin your approach to this issue.

If you want cascading combo boxes (that a generally understood term here), the approach is as simple as this:

When an item is selected from the first combo box, do the following things:
  1. The combo box should have an AfterUpdate event
  2. Design a query in VBA in that event procedure which is based upon the value of that combo box
  3. Assign that query string to the Record Source of the next combo box
  4. Requery the next combo box
  5. Enable the next combo box (this assumes you don't want them to choose anything from this combo box until they've made their first selection)
  6. Repeat these steps for as many combo boxes as necessary

Again, this is the approach. We can help you through any particular struggles and snags you may come across.

Hope this hepps and gets you pointed in the right direction.
Oct 30 '19 #4
NeoPa
32,556 Expert Mod 16PB
Hi Michie.

Welcome to Bytes.com :-)

I see that you've done particularly well at presenting your question. That would be true for anyone posting such a well specified question but it's particularly impressive for a first-timer.

I have an article (Cascaded Form Filtering) that should give you detailed help to handle this.

As someone who obviously cares and tries to lay out their information neatly and easily to read I'll give you a couple of tips. Only a couple as you seem to have worked out the rest already :
  1. In the CODE window spaces can be used to indent. I suspect you may have tried using TABs, which don't, but spaces do.
  2. If you have a block of code between the [CODE]...[/CODE] tags and you don't want an extra blank line showing at the bottom, simply put the closing [/CODE] tag at the end of the last line of your code.
    The opening [CODE] tag isn't as fussy. It will ignore the first new line immediately after it if it finds one.

Let us know how you get on and if you feel you've got what you needed here.
Oct 30 '19 #5

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

Similar topics

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 ...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
2
by: ShadowHawk | last post by:
Hi Everyone. I've been having a little touble with a form I'm working on. (I'm a MS Access hobbiest). I've set up the cascading combo boxes, which is working, (I took the code from Microsoft) on a...
2
by: SPOILED36 | last post by:
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttendance, I also have cascading combo boxes (cboCategory and...
3
by: buddyr | last post by:
Hello, Yesterday I recieved help with two cascading combo boxes on an access form. I went the link http://www.fontstuff.com/access/acctut10.htm And basically used their first example. Now I...
4
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database. The tables that pertain to this issue are tblOrg, tblState, tblCity, and tblZip. I have posted the table structure with only the pertinant fields...
7
by: Toireasa | last post by:
Hi, Newbie Access developer here, and my first post on this forum, so I might not get everything right - thanks in advance for your help and your patience! I'm using Access 2007, in XP. I'm...
1
by: Cydni Edwards | last post by:
I have the below data regarding Cascading 2 Combo Boxes and 3 Tables. I get the list from cboRegion without any problems, cboSector only shows 1 name for 1 Region. Can someone help me to get the 2nd...
2
by: ncsthbell | last post by:
I am using MS Access 2007. I have a form that has two combo boxes, one for divisions, the other for groups. I am trying to create ‘cascading’ boxes that will allow a division to be selected and...
4
by: rhuseman | last post by:
On my form I have 24 combo boxes ( 12 of which are conditional/cascading combo boxes dependent on the users input of the other 12 combo boxes). I've found ways to do it by code each individual...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.