Solved

ListBox Select Item without Index

Posted on 2008-06-19
1
2,095 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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 use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

630 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