Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ListBox Select Item without Index

Posted on 2008-06-19
1
Medium Priority
?
2,101 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

876 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