azizrasul
Well-known Member
- Joined
- Jul 7, 2003
- Messages
- 1,304
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
List box with Multiselect set to Extended.
I have the following code on the click event of a list box.
How do I amend the above code so that when pressing the CTRL key, the correct item are selected\deselected e.g. when I have 3 items all selected on a list box and press CTRL on the middle item, the bottom 2 items deselect rather than just the middle one.
I have the following code on the click event of a list box.
Code:
Dim ctl As Control
Dim x As Variant
Set ctl = Me!lstLandParcelReminders
For Each x In ctl.ItemsSelected
If ctl.Selected(x) = -1 Then
ctl.Selected(x) = True
Else
ctl.Selected(x) = False
End If
Me.Refresh
Next x
Set ctl = Nothing
How do I amend the above code so that when pressing the CTRL key, the correct item are selected\deselected e.g. when I have 3 items all selected on a list box and press CTRL on the middle item, the bottom 2 items deselect rather than just the middle one.