Set Value in Multi Select List Box (1 Viewer)

Thales750

Formerly Jsanders
Local time
Today, 07:05
Joined
Dec 20, 2007
Messages
2,098
Is there a property to use when externally setting the value (and selected row)
of a Multi Select List box.

I don't seem to be able to find it.

Thanks
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:05
Joined
May 7, 2009
Messages
19,234
listbox item index are zero(0) based.
you refer item 1 as item(0).

me.list.selected(itemNo) = True
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:05
Joined
May 7, 2009
Messages
19,234
Me.List0.Selected(Me.List0.ItemData(PKnumber)) = True
 

Thales750

Formerly Jsanders
Local time
Today, 07:05
Joined
Dec 20, 2007
Messages
2,098
Me.List0.Selected(Me.List0.ItemData(PKnumber)) = True

I was unable to make that work: but this version seems to fit the bill.

Code:
    Dim lngRow As Long

    For lngRow = 0 To Me!lstAttendees.ListCount - 1

        If Me.lstAttendees.ItemData(lngRow) = pubSchAssociate Then

            Me!lstAttendees.Selected(lngRow) = True

        End If

    Next

Where pubSchAssociate is a public variable with the Primary Key stored from a previous operation.

Thanks arnelgp
 

Users who are viewing this thread

Top Bottom