Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    2

    Unanswered: Combo box referencing combo box

    I currently have a form that I select a customer from a "Costomer" dropdown box. In order to then have only the items that that customer sells in the "Items" dropdown box, I wrote a query that saves the form, closes the form then opens the form back to that record. It then runs a query with the result being the only items available in the "Items" dropdown box are those that correspond with the "Customer" selected. There has to be a better way to do this. What can I do?

    Ed Fifield

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    In the afterupdate event of the customers combo box set the SQL for the items combo box based on what has been selected in the customers combo. For example:

    Private cboMyCustomersCombo_AfterUpdate()
    Me("cboMyItemCombo").RowSource = "SELECT ItemID, ItemName FROM MyItemTable WHERE (CustomerID = " & Me(cboMyCustomersCombo").Value & ")"
    End Sub

    You will need some validation code to make sure the user has picked a customer.
    Regards
    Justin

  3. #3
    Join Date
    Feb 2005
    Posts
    2

    Red face

    Tahnk you, Justin.
    Ed

Posting Permissions

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