Setting .MultiSelect property of ListBox error

T

Tony_VBACoder

Why would I get the following error when I am trying to
set the .MultiSelect property of my list box?

"Run-time error '2448':
You can't assign a value to this object.


****** My Code *****
' Set the MultiSelect property to Extended
Me.listMeetingDate.MultiSelect = 2
 
R

Rick Brandt

Tony_VBACoder said:
Why would I get the following error when I am trying to
set the .MultiSelect property of my list box?

"Run-time error '2448':
You can't assign a value to this object.

According to Help... that property cannot be changed from code.
 
D

Douglas J. Steele

Rick Brandt said:
According to Help... that property cannot be changed from code.

Not quite, Rick. At least, my copy of help says "This property can be set
only in form Design view."

In other words, if you open the form in Design mode (one of the options with
DoCmd.OpenForm, you should be able to change it.
 
T

Tony_VBACoder

I am a little confused here. With Access 2002, if I bring
up the help on the "MultiSelect" property, here is what
the help says:

**********************************************************
You can set the MultiSelect property by using the list
box's property sheet, a macro, or Visual Basic.

This property can be set only in form Design view.
**********************************************************

I am confused with the first part, because the help states
that you can set the MultiSelect property with Visual
Basic, but then it goes to say, it can only be set in form
Design View. So which is it???
 
D

Douglas J. Steele

As I said, you can set it using VBA, but only if the form's in Design view.
I don't see any contradiction to that in what the Help file says.
 
D

Dirk Goldgar

Tony_VBACoder said:
I am a little confused here. With Access 2002, if I bring
up the help on the "MultiSelect" property, here is what
the help says:

**********************************************************
You can set the MultiSelect property by using the list
box's property sheet, a macro, or Visual Basic.

This property can be set only in form Design view.
**********************************************************

I am confused with the first part, because the help states
that you can set the MultiSelect property with Visual
Basic, but then it goes to say, it can only be set in form
Design View. So which is it???

Being settable only in design view doesn't mean it has to be set
*manually*. You can have VBA code that opens the form in design view
(or switches it to design view), sets the property, and then switches to
form view.
 

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