Results 1 to 4 of 4
  1. #1
    Gary Childress is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    34

    Populate combo box based on value chosen in another combo box

    This is what I'd like to be able to do:



    I have a table called "MainTable". It has a bunch of fields in it. Most of the fields are based on lookup fields. Each lookup field may have at most 10 possible answers or less in it. So there are a limited number of possible values which a particular field can have. For instance, one lookup field may have 3 possible answers, "Yes";"No";"N/A". Another lookup field may have a different set of possible answers.

    I have a form called "Switchboard". It has 2 combo boxes on it, "ComboBox1" and "ComboBox2".

    When I click on "ComboBox1", I want it to display specific fields in "MainTable" in its dropdown list, but not all the fields.

    When I select a value from the drop down list in "ComboBox1", I want "ComboBox2" to populate with all the different answers available for that field in "MainTable".

    Next I want to be able to click a button and call up a query based upon the values in "ComboBox1" and "ComboBox2" where "ComboBox1" represents the field on the table I want searched and "ComboBox2" represents the value in that field I want displayed in the query.

    I'm attaching a copy of the database I'm working on. I've almost got it to where it is doing what I want above except for a few problems:

    1. I don't want "ID" or "CLASS" to show up in ComboBox1. In other words I don't want to query those fields.

    2. "MainQuery" is confusing fields "Row4" and "Row5" because they have identical value lists. Both fields have "Yes";"No";"N/A" for their values. Therefore the way I have it set up now it seems to query ALL fields with the value of ComboBox2. I just want it to pick up the value in ComboBox2 of the field selected in ComboBox1.

    Thanks for any help!
    Attached Files Attached Files

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    What you appear to be referring to are cascading combo boxes. Look at this link on how to make them work.

    http://www.fontstuff.com/access/acctut10.htm

    He describes two ways to do this.

    Additionally, you may want to look at this link and scroll down to the section on combo boxes.

    http://www.datapigtechnologies.com/AccessMain.htm

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Most of the fields are based on lookup fields.
    Step 1: Get rid of the lookup fields. See http://access.mvps.org/access/lookupfields.htm Also see: http://access.mvps.org/access/tencommandments.htm



    When I click on "ComboBox1", I want it to display specific fields in "MainTable" in its dropdown list, but not all the fields.
    1. I don't want "ID" or "CLASS" to show up in ComboBox1. In other words I don't want to query those fields.
    A) In the criteria row of the query, enter <> "ID" and <>"Class"

    or

    B) Put the fields (but not "ID" or "Class") in a table. Base the row source property of ComboBox1 on a query of that table. (My preference)

    When I select a value from the drop down list in "ComboBox1", I want "ComboBox2" to populate with all the different answers
    This is called cascading combo boxes. See Rogers Access Library http://www.rogersaccesslibrary.com/forum/topic389.html or Google "cascading combo boxes"

    -----------------
    Me being picky: Tables have fields. Forms have controls. If the form is bound to a record source, then a control can be bound to a field.

  4. #4
    iib is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Jan 2013
    Posts
    8
    Quote Originally Posted by ssanfu View Post
    Step 1: Get rid of the lookup fields.
    Very often we get this advice. But no one tells us what to use instead!!!

    As a beginner I am using a lot these Lookup Fields for almost all the FK. I want very much to avoid them, but I don't know what shall I use instead.

    I would appreciate your suggestion on this matter.

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

Similar Threads

  1. Auto Populate based on Combo box
    By Mpike926 in forum Forms
    Replies: 16
    Last Post: 09-07-2012, 03:16 AM
  2. Replies: 1
    Last Post: 07-11-2012, 08:36 AM
  3. Replies: 33
    Last Post: 01-13-2012, 07:44 AM
  4. How to populate text box based on Combo Box
    By maxstead in forum Forms
    Replies: 3
    Last Post: 09-08-2011, 01:25 PM
  5. Replies: 4
    Last Post: 01-24-2011, 07:11 PM

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