Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009
    Posts
    95

    Unanswered: Cascading Combo Box Problem

    I have a table (named Brokers) and the table has 3 fields, Branch ID (Primary Key), Originator, and Address.

    I am trying to make cascading combo boxes for Originator and Address. (There are dupes of Originators on the table but all Addresses are different)

    I want the user to be able to select an Originator and based on that selection filter all the addresses out of the other combo box and only show addresses that go with the Originator selection.

    The code I am using right now was retrieved from this website:
    Access Tips: Cascading Lists for Access Forms
    and it does not work. My address combo box is blank, all the time.

    In the Originator combo box after update I have this code...

    Private Sub cboOriginator_AfterUpdate()
    On Error Resume Next
    cboAddress.RowSource = "Select Brokers.Address " & _
    "FROM Brokers " & _
    "WHERE Brokers.Originator = '" & cboOriginator.Value & "' " & _
    "ORDER BY Brokers.Address;"
    End Sub

    Any guidance would be appreciated.

    Thanks,
    CT

  2. #2
    Join Date
    Jun 2009
    Posts
    95
    Update:

    I solved the problem just by changed the criteria in the query for the second combo box to equal the selection of the first one.

    New Problem:
    I would like the second combo box to automatically fill itself in with the first possible selection, isntead of waiting for me to select. Does anybody have any idea how to do that?

    Thanks,
    CT

  3. #3
    Join Date
    Aug 2009
    Posts
    1

    I am having issues as well..

    When I use this code from the website the second combo box selects the id of the record I am calling from table Well Counts by Lease SEPT 2008 instead of the actual field attribute. For example, I am selecting a field unit (CC_NAME) as the attribute for the first combo box (combo85), I want a billing code number (CCNO) populated in the second combo box (combo 91). But instead of it selecting the field name it is selecting ID 21. SInce I am not using the ID it does not coerelate to a number. Is this correct? Or what am I doing wrong?

    On Error Resume Next
    Combo91.RowSource = "Select [Well Counts by Lease SEPT 2008].CCNO " & _
    "FROM [Well Counts by Lease SEPT 2008] " & _
    "WHERE [Well Counts by Lease SEPT 2008].CC_NAME = '" & CC_NAME.Value & "' " & _
    "ORDER BY [Well Counts by Lease SEPT 2008].CCNO;"

Posting Permissions

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