Results 1 to 9 of 9
  1. #1
    Raldow is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    1

    Limit combo box according to selection from previous combo box

    Hi there.

    I have a problem regarding the development of my database. I need to limit a combo box's options according to what was selected in a different combo box.



    ____
    - Details

    > One client has many representatives,
    > Combo_box1 (which contains the client name) must limit combo_box2 (which is a list of client representatives) when a client name is selected in combo_box1.

    - Example

    There are two client representatives: M. Davidson, and T. Simions. Davidson works for Fairwind (his client), and Simions works for Tital (his client).

    Combo_box1 contains a list of clients. Combo_box2 contains a list of representatives. While Combo_box1 is empty, every client representative is in the list (ie. Davidson & Simions). If Combo_box1 has Fairwind entered in it, combo_box2 is updated to contain only those who work for Fairwind (ie. only Davidson, not Simions).

    ____
    Could I have some help in getting this to work? I would be very grateful.

    Thanks in advance.

  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,652
    The concept is called cascading combos. I have a sample here:

    Baldy-Cascading Combos
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    killdozer is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2014
    Location
    New Brunswick
    Posts
    9

    How to ref combo box 2 in a subform while combo box 1 is in the main form

    Hi pbaldy, I have the same problem and I downloaded your sample database. In the afterupdate of events, how do I make ref combo box 2 in the code as it is in the subform of the main form where Combo box 1 is located. I tried "[Forms]![Mainfrm]![sfrm].[cmbox2] = vbNullString" but I get errors as it is not found.

  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,652
    Presuming the code is in the subform, you should be able to use the "Me" syntax, otherwise:

    Forms Refer to Form and Subform properties and controls

    By the way, cascading combos don't really work well in continuous or datasheet view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    killdozer is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2014
    Location
    New Brunswick
    Posts
    9
    Thanks, The ref is working now, but I see what you mean by cascading combos not the best when in datasheet view. My sfrm is in datasheet view. The Cbo on the main forms gives the catagory for the cbo on the sub. The problem now is I select a different catagory for the next row the selection that was in the first row disappears. Any suggestions?

  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,652
    That's the problem. A.D. has an alternative here:

    http://www.rogersaccesslibrary.com/f..._topic560.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    killdozer is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2014
    Location
    New Brunswick
    Posts
    9
    OK thanks, my file is at work. I will check it out Monday. Thanks again for the quick response.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    killdozer is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2014
    Location
    New Brunswick
    Posts
    9
    Hi again pbaldy. I been struggling all day trying to get A.D. solution to work. I was really hoping for a simply soloution. The only two colums in my sub from that I'm concerned with are the two Combo Boxes. That said I should be able to exclude all the other event codes from the other columns from his example database. Looking at his Master Combo box "Author" and his Slave Combo box "Title" I copied and pasted the code from the six events on to mine and tried to screen out that did not apply. Numerious errors. Just to confirm as I'm not a VB person. In the code it offen refers to the Master and Slave Combop boxes Ex."Me(SlaveComboName).SetFocus" Should I actually have the name of the slave combo box in the brackets. I don't see anything in the properities to say that "Author" is the MasterComboboxName, and Title is the SlaveComboboxName. Or is this just understood that the first combo box is the master and the second the slave.

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

Similar Threads

  1. Replies: 4
    Last Post: 01-24-2011, 07:11 PM
  2. Combo Box that doesn't allow selection
    By Ted C in forum Forms
    Replies: 20
    Last Post: 08-09-2010, 04:00 PM
  3. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  4. Replies: 3
    Last Post: 02-26-2009, 10:17 AM

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