Results 1 to 2 of 2
  1. #1
    smba is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    2

    Select between 2 queries in a combobox

    Hello,



    I have a form with some combobox, and I would like to change the values of one of them (combobox2) by selecting between 2 diferent queries in the "Row Source" depending on the value of other combobox (combobox1).

    Is it that possible?

    Regards

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    sounds like you are talking about 'cascading comboboxes'. There are a number of solutions - try googling 'cascading comboboxes' to find out more. A common solution is to have the rowsource of your second combo to be something like this

    Code:
    SELECT *
    FROM myTable
    WHERE afield=[combobox1]
    in the rowsource (as code, not as a query)

    and in the combobox1 afterupdate event put

    combobox2.requery

    if it is not just a matter of changing the criteria then in the combobox1 afterupdate event put something like


    Code:
    select case combobox1
        case 1
            combobox2.rowsource="SELECT * FROM table1"
        case 2
            combobox2.rowsource="SELECT * FROM table2"
    end select

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

Similar Threads

  1. Not able to select from combobox
    By Triel in forum Forms
    Replies: 19
    Last Post: 09-26-2014, 03:51 PM
  2. Select... in combobox
    By gemadan96 in forum Forms
    Replies: 1
    Last Post: 06-03-2014, 03:51 PM
  3. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  4. Impossible to select any value from the ComboBox
    By GaioAugusto in forum Programming
    Replies: 4
    Last Post: 12-31-2013, 03:29 AM
  5. ComboBox, select null?
    By offie in forum Queries
    Replies: 2
    Last Post: 07-19-2013, 06:27 AM

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