Access Database Tip: How to Multiselect in a Listbox

Access Database Tip: How do I multi select in actl.ItemData(selItem) & "'));"
List box?DoCmd.RunSQL (sql)
When you have a list box it is handy to be ableNext selItem
to multiselect to perform some action on multipleSelCt = X
items in the list box. Here is a simple set ofList0.Requery
instructions to get you started. These instructions**********
will create a quick way to multiselect and deleteSave the form
rows from a table.7]Create a table with data for this example
Follow these steps:named "Tmpindextbl. " Make sure you have at
1]create a simple formleast one field named sFileName.
2]add two text boxes named SelCt and LstCtYou will need to add some dummy data for
3]add a list box named List0testing.
4]on the list box properties form tab "Other" setYou can download the example and the demo
the Multi Select to Extendedmdb that accompanies this tip at. Getting the
5]on the "Data" tab setexample there will save you a little work. The
Rowsource type to Table/queryrow source todemo database also has a counter to show you
SELECT tmpIndextbl.sFileName FROM tmpIndextblhow many entries have been selected.
ORDER BY tmpIndextbl.sFileName;BioMation Systems, Inc provides process
6]put this code between the *****on the "Event"improvement services that include solutions used
tab "After update" eventby both large and small companies that are
**********affordable and easy to use. Our products and
Private Sub List0_AfterUpdate()services are proven to enable our customers to
Dim ctl As Control, X As Integer, selItem Asprovide better service to their customers while
Variant, sql As Stringsaving them money in the process. Our
Set ctl = List0customers find that their return on investment is
For Each selItem In ctl.ItemsSelectedmost often realized after using their applications
X = X + 1just a few times.
Debug.Print ctl.ItemData(selItem)sql = "DELETEWhat could BioMation Systems do for you?
tmpIndextbl.sFileName FROM tmpIndextbl"sql = sqlGo ahead, take a look.
& " WHERE (((tmpIndextbl.sFileName)='" &