can't change a list box MultiSelect

smig

Registered User.
Local time
Today, 13:33
Joined
Nov 25, 2009
Messages
2,209
when I try to change in code the MultiSelect property of a list box I get an error:
2448 - you can't assign a value to this object :(

Code:
Me.SelectCompare.RowSource = Me.SelectField.Column(2)
Me.SelectCompare.Requery
Select Case Me.SelectField.Column(3)
    Case "Q"
        Me.SelectData.RowSourceType = "Table/Query"
    Case "L"
        Me.SelectData.RowSourceType = "Value List"
    Case Else
End Select
If Me.SelectField.Column(5) = True Then
[COLOR=darkred]    Me.SelectData.MultiSelect = 1
[/COLOR]Else
    [COLOR=darkred]Me.SelectData.MultiSelect = 0[/COLOR]
End If
Me.SelectData.RowSource = Me.SelectField.Column(4)
Me.SelectData.Requery
 
Apparently that property is read only and can't be changed runtime.
I would suggest, if you really want this, to add a listbox control on top of the other with that setting to 0 (or 1) and depending on what you want show or hide it.

HTH:D
 
this is weired since in the Help they put an example how to change it in code.
To set the MultiSelect property, you can use the following:
Forms("Order Entry").Controls("Country").MultiSelect = 2 ' Extended

I know of the option using two testboxes
 
Last edited:
thanks Bob
Thank you Microsoft :rolleyes:

Well, given how list boxes work, it isn't surprising. But as I said, it would have to be done in design view. So you can open the form hidden and in design view, using code, then save it, close it and reopen. Yes, a bit of a TREK but if you want that functionality you'll have to go down the long and winding road. :D

So what is the purpose of doing it this way?
 
design view will not help as I want to change it after the user is already on the form

BTW - I guess I can't make any change in mde file, can I ?
 

Users who are viewing this thread

Back
Top Bottom