Results 1 to 6 of 6
  1. #1
    rwahdan1978 is offline Advanced Beginner
    Windows 11 Access 2016
    Join Date
    Jun 2024
    Posts
    57

    Thumbs up Change values in combo box after selection

    Hi



    I have 2 combo boxes that has values from users table. after choosing a user in the first combo box I need to update the second combo box to have all the other users (removing the selected user that we chosed from combo 1).

    Example:

    combo 1 have: Sam, Adam, Mike and I choose Mike
    combo 2 will get updated and only have Sam and Adam

    I need to do that programatically.

    Thanks

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    In the afterupdate of combo1, set the source of combo2 to be your fields and criteria WHERE ID <> comboID
    Replace the names to suit.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    This is known as cascading combos. You might want to look it up as you might find it comes in handy for other things.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    In addition to Welshgasmans comments - I would also remove any value that may be in the second combo as it will remain until the user chooses a valid one. e.g. original value in 2nd combo for Sam (list A, B, C) is A. User changes Sam to Adam in the first combo and the 2nd combo list becomes B, D, E. A is not in that list but will still be the value in the combo until user selects a valid one.

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Isn't that part of most posted code for cascading combos? I can't recall as it's been some time since I read anything on this subject. The AfterUpdate event of a parent combo is supposed to include a requery of the child combos. At least I think that's what posted code does. Of course, that assumes the list items are based on a query and not a value list.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    Isn't that part of most posted code for cascading combos?
    depends on the link you find. Some are better than others and makes a difference whether the form is single or continuous

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

Similar Threads

  1. Replies: 5
    Last Post: 05-31-2017, 08:58 AM
  2. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  3. Replies: 3
    Last Post: 12-11-2012, 09:12 AM
  4. Change to selection in combo box
    By corystemp in forum Access
    Replies: 7
    Last Post: 06-28-2010, 10:20 AM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 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