Limiting the number of selections in a List Box Control

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
 
F

fredg

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top