Someone please help. My cascading combo box is not working. I've tried code from several different sites, and I can't get the second box to list anything. I have a table called tblfolder. It has two columns, cabinet and folder. I want to select a cabinet and have that limit the folder options. The cabinet control source is cabinet on another table (tblDocMain). The source is: SELECT DISTINCT [tblfolder].[Cabinet] FROM tblfolder ORDER BY [cabinet];
I've tried several other things, but right not, the after update event is:
Private Sub cboCabinet_AfterUpdate()
On Error Resume Next
cboFolder.RowSource = "Select tblfolder.folder " & _
"FROM tblfolder " & _
"WHERE tblfolder.cabinet = '" & cboCabinet.Value & "' " & _
"ORDER BY tblfolder.folder;"
Every time except for once, the folder combo box came up blank. I had tried putting a SQL statement in the row source field, and at one point the drop down list was working there, but whatever I selected there wasn't showing up on the table.
Please help, I know this must be something simple that I'm missing, the it's driving me nuts.
When I do my cascading combo boxes, I use a select statement that includes an "ID" (which is an integer) and a text value (which is visible in the box). Perhaps you need both values in your combobox (and then you will need to pull out data using "listindex" and "itemdata".) Something tells me that the value property on a combobox may not work (and I stand to be corrected here).
Here is my procedure:
Private Sub cboPeriod_AfterUpdate()
Dim strSQL As String
Dim aValue As Integer
aValue = Me.cboPeriod.ListIndex + 1
'the listindex starts at 0; items in our list start at 1
strSQL = "Select id, period from periods where type = " & aValue & " order by id"
'order by id because data from text files
Me.cboSpecific.RowSource = strSQL ' load second combo box
///// works fine
Nanning China (currently)
(By way of trying to give back)