Results 1 to 5 of 5
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    ListBox selection and disable

    How do you make the second list box highlight the value base on the selection of the first list box because of the only choices available base on the selection of the first list box and vice versa.



    For example: we have month 7, 8, 9, and 10 in the first list box. In the second list box we have 2012 and 2013.

    But 7,8 have 2012 and 9, 10 have 2013.

    When we select 7, 2012 will highlight or can be selected but not 2013. When select 9, 2013 can be selected not 2012.

    In short how to disable selection base on the other list box selection ? Please advise ?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,913
    This is called cascading (or dependent) combobox. A very common topic.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    Your combo row source needs to be based on a table / query or sql statement rather than a value list
    When you do so, the second combo/listbox will only show the year(s) for which data exists for the selected month.

    However, it might be better to swop the order - year in the first listbox ; month in the second ...and if you want ...day/date in a third
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Great, thanks to you both.
    I will do and try the combo box but can this also be done with list box ?

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    In many respects (but not all), combos and listboxes are interchangeable.
    The first listbox can NOT be multiselect for this
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 4
    Last Post: 07-26-2016, 02:53 AM
  2. Replies: 10
    Last Post: 06-18-2013, 02:00 PM
  3. Replies: 3
    Last Post: 12-02-2012, 09:38 AM
  4. Replies: 1
    Last Post: 09-10-2012, 11:21 PM
  5. Replies: 1
    Last Post: 09-27-2010, 06:58 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