Limiting the number of selections in a List Box Control

  • Thread starter Thread starter John Dumay
  • Start date Start date
J

John Dumay

Hi Folks,

I have a list box (multiselect = simple) that is dynamically populated by a
query. I want the user to select only two items from the list and then i want
to use these two items to run another quesry which will be the source data
for a report.

How do i force the List Box to allow only two selections?

Regards,

John Dumay
 
Hi Folks,

I have a list box (multiselect = simple) that is dynamically populated by a
query. I want the user to select only two items from the list and then i want
to use these two items to run another quesry which will be the source data
for a report.

How do i force the List Box to allow only two selections?

Regards,

John Dumay

Code the List box BeforeUpdate event:

If Me.ListBoxName.ItemsSelected.Count > 2 Then
MsgBox "Sorry, only 2 items can be selected."
Cancel = True
End If
 
Back
Top