473,386 Members | 1,715 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,386 software developers and data experts.

Cascading combo/list boxes

15
Hello, I have a combo box that feeds a list box1 which in turn feed another list box2. List box2 values need to remain in list box2 when list box1 has been change by the combo. The content of list box2 will be stored in a table. I guess this is 2 part question: Are there any examples out there on list box2 used as a collection point, and how hard would it be to store the contents of list box2 in a table? Thank you for your help.
Dec 23 '10 #1
20 3110
RuralGuy
375 Expert 256MB
It is pretty easy to have a ListBox display the contents of a table.
Dec 24 '10 #2
MarkP
15
Hello RuralGuy, What I'm trying to resolve is an Access form that the user would use to record events. This requires information to be collected and stored. On the form I have 1 combo box that feeds off of a table and that updates a list box(1). The information from this box(1) is selected and goes to list box(2). This in turn, gets stored in a separate table as a record for that event. My problem is that each item in the combo box that brings up a separate list in box(1), that I select from, needs to be collected in box(2). I don't want to loose the items previous selected from box(1), as I'm adding to this in box(2). How is this accomplish?
Dec 24 '10 #3
RuralGuy
375 Expert 256MB
I'm not real clear what you feel you need. How are you adding the items to Box(2)?
Dec 24 '10 #4
MarkP
15
Merry Xmas and a Happy New Year. Thanks for responding back, I have enclosed a copy of the procedure below for List Box(1). Note: the combo box to list box(1) works okay and I can do the same steps for list box(2), however, I would like to show all of the selections that the user pick from list box(1). Also the combo box has 15 items that the user could pick and list box(1) has anywhere from 5 to 15 items per combo box selection. (Ex. If I was to select the 1st combo box item list box(1) would show 7 items; the next item in the combo box if selected would show 12 items in list box(1) and so on... But I would like to keep my selection shown in list box(2) when selected from list box(1) and to save the whole event to a record in a table.

List box(1) procedure:
Private Sub ListBox1_DblClick(Cancel As Integer)
Dim strItems As String
Dim intItem As Integer
For intItem = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(intItem) Then
strItems = strItems & ListBox1.Column(0, intItem) & ";"

End If
Next intItem
ListBox1Selected.RowSource = ""
ListBox1Selected.RowSourceType = "Value List"
ListBox1Selected.RowSource = strItems
End Sub

Thanks for your help with this problem.
Dec 25 '10 #5
RuralGuy
375 Expert 256MB
Rather than create a ValueList for List2, why not just save the values in a table and let List2 display the table?
Dec 25 '10 #6
MarkP
15
Great idea. So, if I understand what you are saying is to have list1 populate a table on selection and have list2 display the table as it is being populate by list1. Sounds great, do you have the VBA code for this?
Dec 25 '10 #7
RuralGuy
375 Expert 256MB
It looks to me like List2 os populated with the selections in List1 when you double click on List1. Is that correct?
Dec 25 '10 #8
MarkP
15
Yes you are correct. I can also deselect from list2 by holding down the ctl key and double clicking on list1 item that's highlighted.
Dec 25 '10 #9
MarkP
15
The problem I was having was that I could select the items from list1 but when I changed the list of items in list1 by selecting a new item from the combo box my items selected in list2 would remain. List2 items would clear.
Dec 25 '10 #10
MarkP
15
Correction: items selected in list2 would erase.
Dec 25 '10 #11
RuralGuy
375 Expert 256MB
Well the add would be a simple APPEND query in your loop that builds the ListValue string and the delete is simple a DELETE query with a Where clause.
Dec 25 '10 #12
RuralGuy
375 Expert 256MB
So a selection from the ComboBox gives List1 a new RowSource and clears List2, correct?
Dec 25 '10 #13
RuralGuy
375 Expert 256MB
You are still going to have a problem when you make a change in the ComboBox. The table does not really help you remember the selections in List1 unless you make the records unique to your cbo selection and add time. What would you expect to happen if the user make the same cbo selection again? Would you expect your previous selections to appear in List2?
Dec 25 '10 #14
MarkP
15
Yes you are correct about the combo box. If the user make the same cbo selection again then I would need a msg to advise of duplicate entries.
Dec 25 '10 #15
RuralGuy
375 Expert 256MB
Do you plan to just keep adding on to one table for all of the different selections?
Dec 25 '10 #16
MarkP
15
I was hoping to add the contents of the form to a table as a record for each event (daily there could be 10 to 20 records) entered and to use the selections in listbox2 as a string in a column in the table that would be used for reports.
Dec 25 '10 #17
RuralGuy
375 Expert 256MB
Would this table just keep getting bigger every day that goes by?
Dec 25 '10 #18
MarkP
15
Yes the table would increase daily and help in trending reports.
Dec 27 '10 #19
RuralGuy
375 Expert 256MB
Almost there. We need to know what the fields of this table will be and where the values will come from and probably a value from the ComboBox so we can set that value for the filter criteria on the List2 RowSource.
Dec 27 '10 #20
MarkP
15
Thank you for your time. Let me briefly explain what I'm doing. I need to get an assessment of daily events that are analyzed by inspectors. These events would assist the inspectors in trending and focus their attention on problemt areas. I'm trying to capture their assessment in a database that would allow them to run reports. That said, presently, in the database I have two tables and one form. The form name is EventForm. The table that the combo/list boxes feed off of is tbl_CausalFactors. The table that the events are collected is tbl_Events. The causal factor table has 3 columns: CausalID (autonumber), Causals (text), and Factors (text). The event table has several columns but the main two are Causals and Factors and they are text fields. The combo box values would be things like: Alerts, Communications, Corrdination, and Automation for examples. I hope this helps.
Dec 27 '10 #21

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

Similar topics

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...
5
by: RZ15 | last post by:
Hi, I've been through the tutorial for this and I've tried applying it to my database and it almost works but not quite. i have 2 combo boxes, cboPrgrp and cboSupplier. cboPrgrp is supposed to...
26
by: pouj | last post by:
Hey i need help with setting up this on ACCESS 2007 i need step by step i need a form... i select a name (drop list)...then gives me more choice (in next drop list) ....then when i select that...
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...
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...
20
by: luciegiles | last post by:
Hi, I have used the tutorial Cascading Combo/List Boxes to filter the combo box cboCareManager dependent on the entry to cboLocalityTeam - the common code between the two tables is LocalityCode. ...
11
by: slenish | last post by:
I have a new problem that I am playing with involving the combo boxes. Alright now im going to try to explain this as best I can and hope (NeoPa) doesnt notice if I mess up :D This is going to be...
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: 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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.