Results 1 to 9 of 9
  1. #1
    ezybusy is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2015
    Posts
    119

    Hide selected value from combobox

    Hi,


    Let say I have a combo box with the following items: Blue - Green - White - Yellow.

    When the user select one item, another combobox is displayed to allow him to choose another item.

    Now what I want to do is: when the user select an item, that item should not show anymore when the other combobox appears.
    Example: If the user chooses blue the first time, then blue should not show again when the user want to choose another item.

    Can someone help me with that?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    So your problem is you have two combo boxes and both are meant to select colors but you don't want it to be possible for the same color to appear in both selections.

    You can do this with cascading combo boxes but be aware this can't be a one way check.

    For instance, if your user selects BLUE for the first combo box, your second combo box would say GREEN WHITE YELLOW for it's choices.
    Let's say the user then selected GREEN
    Now the user goes back to the first color selection you would want the choices there to be BLUE WHITE YELLOW (omitting green)

    So let's say your table is named tblColors

    Code:
    tblColors
    C_ID   C_Desc
    1     Blue
    2     Green
    3     White
    4     Yellow
    On your table/data entry you have two color combo boxes

    C_ID_Primary
    C_ID_Secondary

    in the row source for your first combo box you would have something like

    SELECT C_ID, C_Desc FROM tblColors WHERE C_ID <> [Forms]![MYFORMNAME]![C_ID_Secondary])

    The row source for your second combo box would likewise be something like

    SELECT C_ID, C_Desc FROM tblColors WHERE C_ID <> [Forms]![MYFORMNAME]![C_ID_Primary])

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I interpret the question differently - the value chosen in the first should be removed from the first.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    ezybusy is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2015
    Posts
    119
    YeS. The value chosen in the first should be removed from the first.
    How can I achieve that?

  5. #5
    ezybusy is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2015
    Posts
    119
    I am not using 2 differents combobox, it's the same combobox that loads again once a value is selected.

  6. #6
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Quote Originally Posted by ezybusy View Post
    YeS. The value chosen in the first should be removed from the first.
    How can I achieve that?
    More info is required. Do you mean once used the value should never be available again, or just for the session, and when this form is reopened some other time all should be available again? The first is easy, the second not so much. Where do the combo values come from and where are they going? Are there a lot of choices or just a few?
    Last edited by Micron; 12-26-2016 at 10:22 AM. Reason: Clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    ezybusy is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2015
    Posts
    119
    just for the session, and when this form is reopened some other time all should be available again.

    Combobox values are from a table.

    I have about 20 values.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  9. #9
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    making the controls into list boxes as suggested (or even using just one) might be much simpler, else I think we're looking at either a way to flag an item as having been used (an extra table field as yes/no) or a temp table that you can remove the item from once selected, but is re-populated with all the values next time the form is open (or if a new record is chosen, as the case may be). In the first case, the flags have to be reset to no once the appropriate action occurs.
    Last edited by Micron; 12-27-2016 at 11:59 AM. Reason: clarification

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

Similar Threads

  1. Replies: 4
    Last Post: 02-19-2016, 10:17 AM
  2. Hide or disable value choice in combobox.
    By floyd in forum Programming
    Replies: 2
    Last Post: 11-16-2013, 12:20 PM
  3. Combobox-dependent show/hide controls
    By focosi in forum Forms
    Replies: 3
    Last Post: 07-31-2011, 06:47 AM
  4. Replies: 5
    Last Post: 07-29-2011, 03:07 PM
  5. Replies: 1
    Last Post: 01-10-2011, 12:25 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