UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> Three Levels Of Cascading Combo Boxes, Office 2010    
 
   
csparkes
post Feb 23 2012, 01:17 PM
Post #1

New Member
Posts: 16



Hi,
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
Case "Burnt"
cbostructurenumber.RowSource = "tblBurnt"
Case "Cat Arm"
cbostructurenumber.RowSource = "tblCatArm"
Case "Granite"
cbostructurenumber.RowSource = "tblGranite"
Case "Hinds Lake"
cbostructurenumber.RowSource = "tblHindsLake"
Case "Long Pond"
cbostructurenumber.RowSource = "tblLongPond"
Case "Meelpaeg"
cbostructurenumber.RowSource = "tblmeelpaeg"
Case "Snook's Arm"
cbostructurenumber.RowSource = "tblsnooksarm"
Case "Upper Salmon"
cbostructurenumber.RowSource = "tbluppersalmon"
Case "Venam's Bight"
cbostructurenumber.RowSource = "tblvenamsbight"
Case "Victoria"
cbostructurenumber.RowSource = "tblvictoria"
End Select
End Sub



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;"

End Sub

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.

Thanks
Go to the top of the page
 
+
 
Start new topic
Replies
Jeff B.
post Feb 23 2012, 01:27 PM
Post #2

UtterAccess VIP
Posts: 8,170
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.)

Good luck!
Go to the top of the page
 
+

Posts in this topic


Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 25th May 2013 - 06:54 PM