I have a listbox that lists several possible rejection codes. The user first requested that I put some default language in a comments field based on the value of the listbox, which works fine. Later the user requested that the listbox be able to allow multiple selections. I found that when I changed the MultiSelect property of the listbox, the default language no longer works.
I am now trying to accommodate both, at least when multiple selections are not required, and they are only required on a small number of records. I inserted a check box called chkMultiple, with the idea that when multiple selections are required, the user can check that box and VBA can change the MultiSelect property of the listbox to 2 (Extended), but the default will be 0 (None).
Here is my code:
The error code is "Run-time error '2448': You can't assign a value to the object, with the object being lstRejCode. The error occurs in both Me.lstRejCode.MultiSelect = lines.
Can you help me debug this code, or make other suggestions to accomplish the same end? Thanks!
I am now trying to accommodate both, at least when multiple selections are not required, and they are only required on a small number of records. I inserted a check box called chkMultiple, with the idea that when multiple selections are required, the user can check that box and VBA can change the MultiSelect property of the listbox to 2 (Extended), but the default will be 0 (None).
Here is my code:
Code:
Private Sub chkMultiple_AfterUpdate()
MsgBox "Check box value is " & Me.chkMultiple.Value
If Me.chkMultiple.Value = 0 Then
Me.lstRejCode.MultiSelect = 0 'None
Else
Me.lstRejCode.MultiSelect = 2 'Extended
End If
End Sub
The error code is "Run-time error '2448': You can't assign a value to the object, with the object being lstRejCode. The error occurs in both Me.lstRejCode.MultiSelect = lines.
Can you help me debug this code, or make other suggestions to accomplish the same end? Thanks!