Results 1 to 6 of 6
  1. #1
    plowe is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2012
    Posts
    3

    Question Cascading Combo / List Boxes

    I have a form (Parts), which has ComboBox > List Box (Multi Value) > List Box (Multi Value)



    I can populate List Box 1 with values based on a single selection in ComboBox, I then make multiple selections in List Box 1.

    My aim is to then populate List Box 2 with with values based on the mulitple selections in List Box 1. (This is where i am stuck)


    Example Data:

    Combo Box (Make1) Row Source = SELECT DISTINCT Vehicles.Make FROM Vehicles;

    Code:

    Private Sub Make1_AfterUpdate()
    Me.Models1.Requery

    End Sub

    List Box (Models1) Row Source = SELECT DISTINCT Vehicles.Model FROM Vehicles WHERE (((Vehicles.Make)=forms!Parts!Make1));

    Code:

    Private Sub Models1_AfterUpdate()
    Me.Engine1.Requery
    End Sub

    List Box (Engine1) Row Source = SELECT DISTINCT Vehicles.Engine FROM Vehicles WHERE (((Vehicles.Model)=forms!Parts!Models1));


    Please could someone shed some light on why the last list box wont display anything.

    The table (Vehicles) has all the fields i need.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Code looks okay offhand. Make sure the column widths property isn't hiding the first column, since you only return 1.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    List Box (Engine1) Row Source = SELECT DISTINCT Vehicles.Engine FROM Vehicles WHERE (((Vehicles.Model)=forms!Parts!Models1));

    I think the problem is with the line

    Vehicles.Model)=forms!Parts!Models1

    What you're saying, here, in plain language, is Select Engines where the Model is Equal to the Value of the Listbox named Models1.

    The problem with this is that the Listbox is Multi-Select, and with the MultiSelect Property set to anything except None, it no longer has a Value Property!

    To find the selections from a Multi-Select Listbox, you have to loop through it to find the selections. Here's an excellent example, by pbaldy, of Post #2, on how to do that:

    http://www.baldyweb.com/multiselect.htm

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Brain cramp! I missed that the control was multi-select. .
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I've tried to find a use for Multi-Select since it sprang out of the collective minds of the Boys of Redmond, with no luck, to date , so I always look carefully at posts that mentions it! I pulled the link to your example, from my archive, before I realized that you were the one who had already responded!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It's a handy tool; I've used it in a number of applications. Several times it's when users what to be able to specify one or more things to report on, like cars, shifts, etc. Today they may want to see cars 1,3,5 & 7 on the report, tomorrow they may want to compare 2,4 & 6. I've got an accounts receivable application where the user is presented with a list of yesterday's runs, and they select the item(s) applicable to the driver they're working on, which are then added to his data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Cascading combo boxes
    By Jackie in forum Access
    Replies: 5
    Last Post: 07-26-2013, 09:07 AM
  2. Sum of Cascading Combo Boxes
    By alonewolf23 in forum Forms
    Replies: 2
    Last Post: 11-20-2011, 02:10 PM
  3. Cascading combo boxes
    By combine21 in forum Forms
    Replies: 3
    Last Post: 12-02-2010, 12:57 PM
  4. Cascading Combo Boxes
    By desireemm1 in forum Programming
    Replies: 1
    Last Post: 10-05-2009, 06:00 AM
  5. Cascading Combo Boxes
    By gjw1012 in forum Access
    Replies: 1
    Last Post: 07-25-2009, 04:59 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