Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2004

    Unanswered: Cascading Combo Box not working!

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


    End Sub

    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.

  2. #2
    Join Date
    Jun 2007
    Maitland NSW,Australia
    In your where clause you will need to reference the cbocabinet field
    in the format forms!the name of the form!cbocabinet as shown below

    "WHERE (((tblfolder.cabinet) = [forms]![form1]![cbocabinet])) " & _

    form1 is the name of the form

  3. #3
    Join Date
    Mar 2009
    Gatineau, Quebec Canada
    Provided Answers: 1
    Quick thought,

    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

    End Sub

    ///// works fine


    J Smith
    Nanning China (currently)
    (By way of trying to give back)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts