I'm trying to populate listboxes on a form, based on saved off values in a table. I select items, save the form, those items are written off to a table. When I open the form again, and double click on a combo box value, I want the form to set items to selected based on the records in the table that have the value from the combo box saved off with them.
Problem is, it will only set the last of a list of saved off values to Selected. I'm guessing Selected wants an array, but when I tried to construct one, it gave a "type mismatch" error. I had constructed a string of values separated by a semicolon.
Here is some pertinent code. It checks to see of a value in the underlying table matches the text value in the listbox. If so, I want that item highlighted as selected.
Any ideas or pointers, folks?Code:Do While Not rst.EOF For i = 0 To Me.lstLOB.ListCount - 1 Me.lstLOB.Selected(i) = False If rst("filterid").Value = CInt(Me.lstLOB.ItemData(i)) Then selectStr = selectStr & i & ";" 'Me.lstLOB.Selected(i) 'THIS ONLY FLAGS THE LAST ONE COMING THROUGH End If Next rst.MoveNext Loop Me.lstLOB.Selected(selectStr) = True 'Gives type mismatch error.
David