Solved

ListBox Select Item without Index

Posted on 2008-06-19
1
2,092 Views
Last Modified: 2008-06-19
Hi,

How can I multiple select items in a ListBox without knowing the Index?

Any workaround?

I'm using MS Access 2002.
' Can I do something like this:
List134.Selected("item 1") = True
List134.Selected("item 2") = True
 
' Instead of this:
List134.Selected(0) = True
List134.Selected(1) = True

Open in new window

0
Comment
Question by:cukcuk
1 Comment
 
LVL 7

Accepted Solution

by:
Chrisedebo earned 50 total points
ID: 21820454
use a for next loop to loop through the items in the list and set selected to true if you find the value you are looking for.
Dim i as integer
 
For i = 0 To List134.ListCount - 1
    If List134.ItemData(i) = "item 1" Or List134.ItemData(i) = "item 2" Then List134.Selected(i) = True
Next

Open in new window

0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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 …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

785 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