Hi All,
I’m trying to use the multi-select property on a list box, but… I want to limit the number of selections to seven. I’ve been trying to use the following….
Private Sub IndexAccount_BeforeUpdate(Cancel As Integer)
[tab]Static indexAccountSelected(0 To 7) As Long
[tab]indexAccountSelected(IndexAccount.ItemsSelected.Count-1) = IndexAccount.ItemsSelected.???
[tab]If IndexAccount.ItemsSelected.Count = 8 Then
[tab] [tab]IndexAccount.Selected(indexAccountSelected(7)) = False
[tab] [tab]Cancel = True
[tab]End If
[tab]SelectCount = IndexAccount.ItemsSelected.Count
End Sub
Desired behavior is to make the eighth selection appear to not happen. I can make the eight selected item down the list unselect but that gets odd if items are selected in random order.
I’m stumped & I didn’t see it in Access help or in the Tek-Tips FAQs or history. Grrrrr! OK, I’m a newbie to VBA but I gotta learn sometime.
I’m trying to use the multi-select property on a list box, but… I want to limit the number of selections to seven. I’ve been trying to use the following….
Private Sub IndexAccount_BeforeUpdate(Cancel As Integer)
[tab]Static indexAccountSelected(0 To 7) As Long
[tab]indexAccountSelected(IndexAccount.ItemsSelected.Count-1) = IndexAccount.ItemsSelected.???
[tab]If IndexAccount.ItemsSelected.Count = 8 Then
[tab] [tab]IndexAccount.Selected(indexAccountSelected(7)) = False
[tab] [tab]Cancel = True
[tab]End If
[tab]SelectCount = IndexAccount.ItemsSelected.Count
End Sub
Desired behavior is to make the eighth selection appear to not happen. I can make the eight selected item down the list unselect but that gets odd if items are selected in random order.
I’m stumped & I didn’t see it in Access help or in the Tek-Tips FAQs or history. Grrrrr! OK, I’m a newbie to VBA but I gotta learn sometime.