Free Ebooks Download
Submit Articles | Member Login | Top Authors | Most Popular Articles | Submission Guidelines | Categories | RSS Feeds See As RSS
 
 
   
Forgot Password?    New User?
My Jewelry Store Designer Brand Clothes
 
Welcome to AllGoodArticles - Submit Free Articles For Massive Exposure,Publishers,Aurthors,writers !

Articles » Education >> View Article



By: Jon Watson

Access Database Tip: How do I multi select in a List box?

When you have a list box it is hand to be able to multiselet to perform some action on multiple items in the list box. Here is a simple set of instructions to get you started. These instructions will create a quick way to multiselect and delete rows from a table.

Follow these steps:

1]create a simple form

2]add two text boxes named SelCt and LstCt

3]add a list box named List0

4]on the list box properties form tab "Other" set the Multi Select to Extended

5]on the "Data" tab set
Rowsource type to Table/query
row source to SELECT tmpIndextbl.sFileName FROM tmpIndextbl ORDER BY tmpIndextbl.sFileName;

6]put this code between the *****on the "Event" tab "After update" event

**********
Private Sub List0_AfterUpdate()
Dim ctl As Control, X As Integer, selItem As Variant, sql As String

Set ctl = List0
For Each selItem In ctl.ItemsSelected
X = X + 1
Debug.Print ctl.ItemData(selItem)
sql = "DELETE tmpIndextbl.sFileName FROM tmpIndextbl"
sql = sql & " WHERE (((tmpIndextbl.sFileName)='" & ctl.ItemData(selItem) & "'));"
DoCmd.RunSQL (sql)

Next selItem
SelCt = X
List0.Requery

**********

Save the form

7]Create a table with data for this example named "Tmpindextbl. " Make sure you have at least one field named sFileName.
You will need to add some dummy data for testing.

You can download the example and the demo mdb that accompanies this tip at. Getting the example there will save you a little work. The demo database also has a counter to show you how many entries have been selected.
http://www.biomationsystems.com/AccessTips.htm

BioMation Systems, Inc provides process improvement services that include solutions used by both large and small companies that are affordable and easy to use. Our products and services are proven to enable our customers to provide better service to their customers while saving them money in the process. Our customers find that their return on investment is most often realized after using their applications just a few times.

What could BioMation Systems do for you?

Go ahead, take a look.

Jon Watson is the founder of Biomation Systems, Inc. With 26 years experience helping Fortune 500 companies with process improvement he formed BioMation to bring the same expertise to smaller companies that need the same improvements at an affordable price.

See All articles From Author

Technorati Profile

For Safe and Fast Browsing