All
I have a form with a lot of listboxes. Each listbox got its own "Reverse All"-button in which selected items become unselected and vice-versa.
Instead of using the same code for each listbox, I try te do this with a subroutine which gets the name of the listbox as a parameter.
For some reason, I get Run-time error "2465" application defined or object defined error
The current code is
I have a form with a lot of listboxes. Each listbox got its own "Reverse All"-button in which selected items become unselected and vice-versa.
Instead of using the same code for each listbox, I try te do this with a subroutine which gets the name of the listbox as a parameter.
For some reason, I get Run-time error "2465" application defined or object defined error
The current code is
Code:
Private Sub cmdReverseCountry_Click()
ReverseListbox "cboReport"
End Sub
Private Sub cmdReverseRegion_Click()
ReverseListbox "cboRegion"
End Sub
Public Sub ReverseListbox(strX As Variant)
Dim intCounter As Integer
For intCounter = 0 To Form.strX.ListCount - 1
Form.strX.Selected(intCounter) = Not Form.strX.Selected(intCounter)
Next intTeller
End Sub