Cascading Multiselect Listbox

Svgmassive
Svgmassive used Ask the Experts™
on
I would like to create a listbox row source based on a selection in another listbox.Any examples for Ms Access
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software & Systems Engineer
Commented:
A simplified code :
Dim ListItem as Variant
Dim intCount as Integer
 For intCount = ListBoxSOURCE.ListCount - 1 To 1 Step -1
    ListItem = ListBoxSOURCE.ItemData(intCount )
   ListBoxDestination.AddItem ListItem
Next

Open in new window

Distinguished Expert 2017

Commented:
In this regard, listboxes work the same way that combos work.  In the dependent listbox's RowSource include selection criteria that references the controlling listbox.

Select ... From ... Where thePK = Forms!myform!lstMajor

Then in the AfterUpdate event of lstMajor, requery the dependent listbox

me.lstDependent.Requery

Or, if you prefer, you can use any other "cascading combos" solution.
Actually depends if you need to have more then one value selected, if yes then set the list box multi select property to either simple or extended and use John's suggestion otherwise set muti select to none and use it the way Pat has suggested.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial