Change MultiSelect property of ListBox during runtime

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a list box control. I set ListBox's MultiSelect = simple, which
allows user to select multiple values.

I want to allow user to change the list box to single select during
runtime. I set

listbox.MultiSelect = 0

It said that can not assign value to MultiSelect. I have a look on Object
Browser and found this property is read/write one.

How to change MultiSelect property of a listbox in runtime?

Thanks
Quang
 
The property is Read/Write, but only in design view.

To change the behaviour without changing to design view, you could use two
list boxes with different values for the MultiSelect property, and toggle
their Visible property.
 
As it says in the Help file, "This property can be set only in form Design
view."

You'd have to switch the form to Design view, change the property, then
change the form view back. Note that this won't be possible if your user has
the Runtime version of Access (nor do I think it'll be possible in an MDE).
Why not simply introduce logic to tell your user when more than one item has
been selected?
 
I will follow suggestion of Douglas. I keep ListBox MultiSelect=simple (user
can select more than one item), just write small code to unselected the
previous selected item when user click another one.

Thanks
Quang
 
Back
Top