Results 1 to 5 of 5

Thread: Combo Box Help

  1. #1
    Join Date
    Jul 2009

    Lightbulb Unanswered: Combo Box Help

    What's up guys.

    I have two combo boxes. I've been toying around in VBA but what I'd like to know is if there is a way to hide certain contents of one combo box based on what's selected in another combo box.

    I was initially going to just have the unwanted contents and removed and then added in again but that way doesn't seem to be the best way to do it.

    Any ideas?

  2. #2
    weejas is offline Grumpy old man (training)
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 17
    You can change the record source of the second box based on the value selected in the first.
    10% of magic is knowing something that no-one else does. The rest is misdirection.
    Beers earned: 2

  3. #3
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    The concept is called "cascading comboboxes" although the exact same thing applies to Listboxes with the MultiSelect Property set to None, and the code is interchangeable. Here are a couple of links with examples:

    Access Tips: Cascading Lists for Access Forms

    Cascading Combo/List Boxes - Microsoft Access / VBA insights

    If you Google the term along with the "Access" you'll probably get a gazillion hits!

    Linq ;0)>
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jul 2009
    Thanks but I've been trying that using this as an example.

    Basing one combo box on another - Access -

    The first combo box (the independent one) grabs the right category data from the category table, but the product table doesn't grab anything.

    This is what I have typed into the row source.
    SELECT Products.Product, Products.PID, Products.CID

    FROM Products

    WHERE (((Products.CID)= Forms![Combo Form]!User_Type)) ORDER BY

    CID represents the category ID and PID the product ID, and the combo box is named User Type but it's pretty much supposed to do what the product combo box is supposed to do but it isn't working.

  5. #5
    Join Date
    Jul 2009
    I think the discrepancy is with the CID (Category ID) because when i look a the example database, the Product table doesn't even have a category ID, yet it's included in the query.


Posting Permissions

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