Type Mismatch
Posted by Stacy on April 26, 2001 8:00 AM
Hello...I have created two list boxes and a button to add the selected items on the left(listbox1) to the list box on the right (listbox2). I copied the code from a book which is pasted below. I am receiving a 'type mismatch' error and I can't seem to find the problem. A friend suggested something about the active x controls....can someone please help??? Thank you very much in advance!!
Private Sub AddButton_Click()
If ListBox1.ListIndex = -1 Then Exit Sub
If Not cbDuplicates Then **(this is a check box)**
For i = 0 To ListBox2.ListCount - 1
If ListBox1.Value = ListBox2.List(i) Then
Beep
Exit Sub
End If
Next i
End If
ListBox2.AddItem ListBox1.Value ***(this is where the mismach is)***
End Sub