can't change a list box MultiSelect (1 Viewer)

smig

Registered User.
Local time
Today, 13:43
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
 

Guus2005

AWF VIP
Local time
Today, 12:43
Joined
Jun 26, 2007
Messages
2,641
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
 

smig

Registered User.
Local time
Today, 13:43
Joined
Nov 25, 2009
Messages
2,209
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:

smig

Registered User.
Local time
Today, 13:43
Joined
Nov 25, 2009
Messages
2,209
thanks Bob
Thank you Microsoft :rolleyes:
 

boblarson

Smeghead
Local time
Today, 03:43
Joined
Jan 12, 2001
Messages
32,059
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?
 

smig

Registered User.
Local time
Today, 13:43
Joined
Nov 25, 2009
Messages
2,209
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 ?
 

boblarson

Smeghead
Local time
Today, 03:43
Joined
Jan 12, 2001
Messages
32,059
design view will not help as I want to change it after the user is already on the form
You are right, it probably wouldn't work too well.
BTW - I guess I can't make any change in mde file, can I ?
That is a definite - correct.
 

Users who are viewing this thread

Top Bottom