Setting MultiSelect Properties to a ListBox at Runtime

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

Guest

From what I can gather from the Access 2002 Help file (see below), this
property CAN be set at Runtime. But I continue to get Error 2448 'You can't
assign a value to this object' Any revelations are greatly appreciated.

Example- To set the MultiSelect property, you can use the following:

Forms("Order Entry").Controls("Country").MultiSelect = 2 ' Extended.
 
Without testing, I would expect that your code would work only if the form
was open in design view.
 
Access101 said:
From what I can gather from the Access 2002 Help file (see below),
this property CAN be set at Runtime. But I continue to get Error
2448 'You can't assign a value to this object' Any revelations are
greatly appreciated.

Example- To set the MultiSelect property, you can use the following:

Forms("Order Entry").Controls("Country").MultiSelect = 2 ' Extended.

I don't believe it can be changed in Runtime. Would it work for you to have
two ListBoxes in the same form space and toggle which one is visible? Then
you can have one set to Multi-Select and one that is not.
 
That's a good idea.

As a consolation, I would at least like to know why the HELP file would
advocate VBA code for something that can't be changed at runtime. My,
albeit, limited understanding of VBA code, is that it can only be run at
runtime.

What is a neophyte like me not understanding?
 
Lots of things have been lost in the Help file since Access 97 (arguably the
best Access help file).

There, it explicitly states "This property can be set only in form Design
view."
 
Back
Top