Results 1 to 4 of 4
  1. #1
    Ultimateneo is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018

    cascading comboboxes

    Hello i have a query where i want either 1 combobox to filter and show all records or if the user drills down to the 2nd combobox the results are filtered even further.

    I have the [forms]![frmparts]![cboproduct]

    so if they select the product and then go to the combobox search by part no it should show all partnumbers for that product.

    If they select the combobox after the product then they would get a shorter list for example parts that connect to the chassis or parts that are on the main pcb or the PSU.

    I have tried doing the or in the criteria and it hasnt worked

    so i have both comboboxes in the criteria and then or just the product combobox with Is Null and = ""

    Does not work.

    Would I have to have 2 queries and select them in vba depending on what was selected or can this be done in a single query?

    So basically if 1 combobox is selected then the user will get all parts or if the user selects both comboboxes the user will get a more refined list.

    Thank you for any help much appriciated

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Ottawa, Ontario, Canada; West Palm Beach FL
    Can you show us the design of your tables and any relationships?
    Your comboboxes will derive their data from your table(s).
    See the Similar Threads at the bottom of the page for more info.
    You can also search/google for Cascading combo MS Access

    Good luck.

  3. #3
    Ultimateneo is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Here are the design of the tables with the relationships.

    I can do it with 2 queires, but just wondering if it is possible to do with 1 query
    Attached Thumbnails Attached Thumbnails Capture.PNG  

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Ontario, Canada
    cascading combo boxes is probably one of the most asked questions thus there are TONS of posted examples. If that's what you're asking how to do it doesn't make a whole lot of sense to repeat it here.

    If you're asking how to pass only the value from combo A to a query, or combo A AND combo B (but not combo B alone) this is best done via code. The code constructs the SELECT portion of a query, then if combo A is not null, adds its selected value as part of the WHERE clause. If combo B is not null, it adds that to the WHERE clause as well. If not, it just goes with the first part. Then you execute the constructed sql statement in code. Otherwise, you'd have to use 2 queries - one for A and one for A AND B and find a way to know which one to run. I think code is the only realistic option if you want to be able to allow A or B as well as A and B,
    - "doesn't work" doesn't help. Implement changes in copies of your database.
    Iím telling everyone it's good to eat dried grapes. Itís all about raisin awareness.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Cascading comboboxes
    By hinchi1 in forum Access
    Replies: 1
    Last Post: 07-04-2018, 04:52 AM
  2. Cascading Comboboxes
    By JennyL in forum Access
    Replies: 3
    Last Post: 03-13-2017, 11:26 AM
  3. Cascading ComboBoxes
    By GAccess in forum Forms
    Replies: 1
    Last Post: 03-06-2012, 05:02 AM
  4. Symmetric Cascading Comboboxes
    By schwabe in forum Forms
    Replies: 15
    Last Post: 02-02-2012, 11:38 AM
  5. Cascading Comboboxes and Sub Forms
    By PaulCW in forum Forms
    Replies: 6
    Last Post: 10-07-2011, 12:08 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums