B
BigPig
Hello All,
I am trying to add selected items from one listbox to another on the same
form. I get this error when running the code below: Run-time error '381':
Could not set the list property. Invalid property array index.
Here's the code: Where the form is frm_billing_screen, the listbox that I
want to retrieve data from is lst_bs_school and the listbox that I want to
additems to is lst_bs_bm. lst_bs_school has a rowsource, but the other does
not. I'm hoping you're not going to tell me that I can't use the rowsource
property for the one listbox.
With frm_billing_screen
Dim x As Integer
For x = 0 To .lst_bs_school.ListCount - 1
..lst_bs_bm.Clear
..lst_bs_bm.ColumnCount = 6
..lst_bs_bm.ColumnWidths = "49.95 pt;75 pt;60 pt;49.95 pt;40 pt;100 pt"
If .lst_bs_school.Selected(x) = True Then
..lst_bs_bm.AddItem .lst_bs_school.List(x, 0)
..lst_bs_bm.List(x, 2) = .lst_bs_school.List(x, 1)
..lst_bs_bm.List(x, 3) = .lst_bs_school.List(x, 2)
..lst_bs_bm.List(x, 4) = .lst_bs_school.List(x, 3)
..lst_bs_bm.List(x, 5) = .lst_bs_school.List(x, 4)
..lst_bs_bm.List(x, 6) = .lst_bs_school.List(x, 5)
..lst_bs_school.Selected(x) = False
End If
Next
End With
Thanks.
I am trying to add selected items from one listbox to another on the same
form. I get this error when running the code below: Run-time error '381':
Could not set the list property. Invalid property array index.
Here's the code: Where the form is frm_billing_screen, the listbox that I
want to retrieve data from is lst_bs_school and the listbox that I want to
additems to is lst_bs_bm. lst_bs_school has a rowsource, but the other does
not. I'm hoping you're not going to tell me that I can't use the rowsource
property for the one listbox.
With frm_billing_screen
Dim x As Integer
For x = 0 To .lst_bs_school.ListCount - 1
..lst_bs_bm.Clear
..lst_bs_bm.ColumnCount = 6
..lst_bs_bm.ColumnWidths = "49.95 pt;75 pt;60 pt;49.95 pt;40 pt;100 pt"
If .lst_bs_school.Selected(x) = True Then
..lst_bs_bm.AddItem .lst_bs_school.List(x, 0)
..lst_bs_bm.List(x, 2) = .lst_bs_school.List(x, 1)
..lst_bs_bm.List(x, 3) = .lst_bs_school.List(x, 2)
..lst_bs_bm.List(x, 4) = .lst_bs_school.List(x, 3)
..lst_bs_bm.List(x, 5) = .lst_bs_school.List(x, 4)
..lst_bs_bm.List(x, 6) = .lst_bs_school.List(x, 5)
..lst_bs_school.Selected(x) = False
End If
Next
End With
Thanks.