Solved

Cascading Multiselect Listbox

Posted on 2016-09-20
3
36 Views
Last Modified: 2016-10-06
I would like to create a listbox row source based on a selection in another listbox.Any examples for Ms Access
0
Comment
Question by:Svgmassive
3 Comments
 
LVL 13

Accepted Solution

by:
John Tsioumpris earned 500 total points
ID: 41806330
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

0
 
LVL 34

Expert Comment

by:PatHartman
ID: 41806976
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.
0
 
LVL 3

Expert Comment

by:bfuchs
ID: 41809723
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now