Limit the number of values in a Multi Select list box

S

Sandy

Hi
Can anyone tell me how to limit the number of selections a
user can make in a multiselect list box.

I know how to count them and I want to stop the users from
selecting more than 5 values at a time.

Thanks in advance
Sandy
 
B

Bill Taylor

This is to lengthy to give code example but you can find example in online
VBA help. search for listbox and view "selected" property. create a loop
that counts the selected items with the click event of the control. when it
reaches 5 either run the code or action you desire or simply set the locked
property to true which will prevent the user from selecting anymore items.
maybe move the focus to the next control or command button to process the
selected items.
HTH
 

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