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

    Two/ three list box, when selected one


    Hello,

    I actually have 4 list box.
    They all have data in there that are related but shows different information. When a user selects one of them. I want the other three to
    highlight the data that is of what they selected in the three other list box and then move it to the top of the list.

    In the list box that they selected I want the user to be able to un-select the list and the data in the other three list box goes back to normal. However each time they make a selection to the list it highlights the related value from the other three list box and move it to the top of the list.

    One catch sometimes the list box can only have one value. Only one list box is allow selection.

    Can this be done. Please advise ?
    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    combo 2 source uses combo1 as criteria in the query
    but you must refresh combo2 when combo1 is chosen....
    cboStates has all state names. When user picks a state, the cboCity must be refreshed
    cboCity.rowsource = qsCities1State
    sql= select City from tCities where [state]=forms!myForm!cboState

    Code:
    '----------------
    sub cboState_Afterupdate()
    '----------------
    cboCity.requery
    end sub
    do this for the 3 sub boxes.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    I think the trick is to add a calculated field in the row sources for the three list boxes dependant on the selectable one called IsSelected:iif([MyID] = Forms!MyForm!lstSelect.Column(x),"Y","N") where x is the zero-based index of the could holding the ID that relates the data and sort descending on that first before any other sort order.
    Then after your selection you requery each of the listboxes to move the related data first then you select it:
    Code:
    Forms![MyForm].Controls("lstBox1").Selected(0) = True
    Forms![MyForm].Controls("lstBox2").Selected(0) = True
    Forms![MyForm].Controls("lstBox3").Selected(0) = True
    Cheers,
    Vlad

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

Similar Threads

  1. Populate Text Box With Selected Value From List Box
    By chalupabatman in forum Forms
    Replies: 27
    Last Post: 08-17-2016, 06:24 AM
  2. How to detect items selected in a list box
    By LonghronJ in forum Modules
    Replies: 3
    Last Post: 08-05-2016, 04:48 PM
  3. Replies: 4
    Last Post: 07-27-2016, 12:07 PM
  4. Replies: 1
    Last Post: 09-19-2013, 11:43 AM
  5. Replies: 4
    Last Post: 06-16-2011, 09:30 PM

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