Three Levels Of Cascading Combo Boxes, Office 2010
Feb 23 2012, 01:17 PM
I'm trying to set up three cascading combo boxes. I have the first two set up and working but when I try to add the third I get a blank drop down list. The second combobox is a mutliple row source and for the third, I'm trying to do a single source table. Don't know much about code.
My first box (cboreservoir) has the following code AfterUpdate:
Private Sub cboreservoir_AfterUpdate()
On Error Resume Next
Select Case cboreservoir.Value
cbostructurenumber.RowSource = "tblBurnt"
Case "Cat Arm"
cbostructurenumber.RowSource = "tblCatArm"
cbostructurenumber.RowSource = "tblGranite"
Case "Hinds Lake"
cbostructurenumber.RowSource = "tblHindsLake"
Case "Long Pond"
cbostructurenumber.RowSource = "tblLongPond"
cbostructurenumber.RowSource = "tblmeelpaeg"
Case "Snook's Arm"
cbostructurenumber.RowSource = "tblsnooksarm"
Case "Upper Salmon"
cbostructurenumber.RowSource = "tbluppersalmon"
Case "Venam's Bight"
cbostructurenumber.RowSource = "tblvenamsbight"
cbostructurenumber.RowSource = "tblvictoria"
My second box (cbostructurenumber) has the following code AfterUpdate
Private Sub cbostructurenumber_AfterUpdate()
On Error Resume Next
cbostructurename.RowSource = "Select tblstructurename.structurename " & _
"FROM tblstructurename " & _
"WHERE tblstructurename.label = '" & cbostructurename.Value & "' " & _
"ORDER BY tblstructurename.structurename;"
My single source table for the third combobox is tblstructurename where [label] is a full list of the structure numbers and [structurename] is the corresponding structure name.
Can anyone help me with this coding? I'm lost at this point.
Feb 23 2012, 01:27 PM
From: Pacific NorthWet
This is only a guess, based on my interpretation of the tablenames you provided ...
I suspect that you have one table per (?lake, river, body of water, ...?). If that is a fairly accurate guess, your database would benefit from further normalization. ... and you'd need/want to do that BEFORE working out your cascading comboboxes.
Please post a description of the underlying tables, and what kind of data your storing in them.
Please provide the version of Access you're using.
(by the way, basing a combobox directly on a table doesn't give you much flexability. Instead, consider building a query against the table(s) and using that query as the rowsource for the combobox.)
|Go to Top · Lo-Fi Version||Time is now: 25th May 2013 - 06:54 PM|