Programmatically find and select an item in multi select list box

ken1921

New member
Local time
Yesterday, 22:51
Joined
Apr 23, 2015
Messages
7
Hi

I have a multi slect list box (simple) and I need to find and select an item using vba - eg the bound column is the ID field and I need to select a specific ID (which will be different each time) as opposed to selecting the 100th record for example.

How do I do this?

Many thanks
 
1. Multi select list take a lot of code.
2. But single select via query takes 1 line of code.

The list box can be 'searched'
ex. type V,and the list jumps to the 1st V item.
User dbl-clicks the item, the dbl-click event runs an append query to add the 'selected item' table. The picked list gets refreshed,to show the new addition. LstPicks.requery
A delete query can be added to the lstPicked list to remove items.

So in the end, you have a table of of the picks to use in other queries to update another table by linking it.
 
Along the lines of this (declaring and setting stuff elsewhere):

Code:
    For i = 0 To ctl.ListCount - 1
      If ctl.ItemData(i) = YourDesiredValue Then
        ctl.Selected(i) = True
        Exit For
      End If
    Next i
 

Users who are viewing this thread

Back
Top Bottom