Results 1 to 7 of 7
  1. #1
    nkuebelbeck is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    91

    multi level drop down

    table


    id name parent_id
    1 ford
    2 mustang 1

    I want to create a multi level selection for my form. I have designed the table above with three columns. I would like the parent_id to display at the first 'level', the second level should be all the id's/names where the parent_id is equal to that level's id. I was thinking I could use a combo box, but I can't for the life of me figure it out. Tried googling for it but I just don't know the right keywords...or it's just not my day.

    Here is a visual of what I am trying to create in access.

    http://www.red-team-design.com/wp-co...pdown-menu.png

    I would like to return the lowest level id and store it for later use.

    any help is appreciated.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    Your first combo box should be any record in your table that does not have a parent_ID

    Code:
    SELECT * FROM table WHERE isnull(Parent_ID)
    Your first combo box should list only those records associated with the items in your first comb box

    Code:
    SELECT * FROM table WHERE Parent_ID = [Forms]![FormName]![Parent_ID]
    In the ON EXIT property of your first combo box (Parent_ID field) have this code:

    ChildField.requery

    Where childfield is the name of the field that is going to store the model of car.

    By the way this is called 'cascading combo boxes' there are a bazillion examples out there (including this forum) if you're looking for the proper terminology.

  3. #3
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Another good way;
    First combo box code, "SELECT ID, Name FROM table;"

    Second combo box code, "SELECT ID, Name FROM Table WHERE ID = " & Combo box1ID;

    The Column widths for bot boxes should be 0;1; Showing just the name .

    Both will work this just a different way.

    Dale

  4. #4
    nkuebelbeck is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    91
    This requires two separate combo boxes? I was hoping to get away with just one and nest them somehow

  5. #5
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    You example shows 2 combo boxes.


    Dale

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You cannot nest combo boxes. You are thinking of something like a treeview list for folders/files? I don't know of any way to do that.

  7. #7
    nkuebelbeck is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    91

    thanks

    Quote Originally Posted by ssanfu View Post
    You cannot nest combo boxes. You are thinking of something like a treeview list for folders/files? I don't know of any way to do that.
    Thanks, I'll just have to use two combo boxes and cascade them.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-10-2012, 06:15 PM
  2. Replies: 3
    Last Post: 11-29-2011, 07:01 AM
  3. Problem creating Multi level list boxes - pleas help!
    By AccessConfused in forum Access
    Replies: 6
    Last Post: 10-24-2010, 09:30 PM
  4. generate multi-level csv
    By shank in forum Queries
    Replies: 5
    Last Post: 09-16-2010, 04:25 AM
  5. Multi Level Form
    By bkelly in forum Access
    Replies: 2
    Last Post: 08-28-2009, 11:15 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