Hi,
where I should put the code. I aware that it will display all if I set row property. what I want is there is search button to diplsay what I search and items will display in listbox. but now currently it only display up to 9 colummn. As such when I select items in listbox, some info not display in activeuserform due to constraint.
My code:
Private Sub ListBox1_Click()
If Me.ListBox1.ListIndex = -1 Then 'not selected
MsgBox " No selection made"
ElseIf Me.ListBox1.ListIndex >= 1 Then 'User has selected
r = Me.ListBox1.ListIndex
With Me
.TextBox1.Value = ListBox1.List(r, 0)
.TextBox2.Value = ListBox1.List(r, 1)
.TextBox3.Value = ListBox1.List(r, 2)
.TextBox4.Value = ListBox1.List(r, 3)
.TextBox5.Value = ListBox1.List(r, 4)
.TextBox6.Value = ListBox1.List(r, 5)
.TextBox13.Value = ListBox1.List(r, 6)
If ListBox1.List(r, 7) = "Good" Then
.CheckBox1 = True
.CheckBox2 = False
.CheckBox3 = False
End If
If ListBox1.List(r, 7) = "Average" Then
.CheckBox2 = True
.CheckBox1 = False
.CheckBox2 = False
End If
If ListBox1.List(r, 7) = "Poor" Then
.CheckBox3 = True
.CheckBox1 = False
.CheckBox2 = False
End If
If ListBox1.List(r, 8) = "Good" Then
.CheckBox4 = True
.CheckBox5 = False
.CheckBox6 = False
End If
If ListBox1.List(r, 8) = "Average" Then
.CheckBox5 = True
.CheckBox4 = False
.CheckBox6 = False
End If
If ListBox1.List(r, 8) = "Poor" Then
.CheckBox6 = True
.CheckBox4 = False
.CheckBox5 = False
End If
If ListBox1.List(r, 9) = "Good" Then
.CheckBox7 = True
.CheckBox8 = False
.CheckBox9 = False
End If
If ListBox1.List(r, 9) = "Average" Then
.CheckBox8 = True
.CheckBox7 = False
.CheckBox9 = False
End If
If ListBox1.List(r, 9) = "Poor" Then
.CheckBox9 = True
.CheckBox7 = False
.CheckBox8 = False
End If
If .ListBox1.List(r, 10) = "Good" Then
.CheckBox10 = True
.CheckBox11 = False
.CheckBox12 = False
End If
If ListBox1.List(r, 10) = "Average" Then
.CheckBox11 = True
.CheckBox10 = False
.CheckBox12 = False
End If
If ListBox1.List(r, 10) = "Poor" Then
.CheckBox12 = True
.CheckBox10 = False
.CheckBox11 = False
End If
If ListBox1.List(r, 11) = "Good" Then
.CheckBox13 = True
.CheckBox14 = False
.CheckBox15 = False
End If
If ListBox1.List(r, 11) = "Average" Then
.CheckBox14 = True
.CheckBox13 = False
.CheckBox15 = False
End If
If ListBox1.List(r, 11) = "Poor" Then
.CheckBox15 = True
.CheckBox13 = False
.CheckBox14 = False
End If
.cmbAmend.Enabled = True 'allow amendment or
.cmbDelete.Enabled = True 'allow record deletion
.cmbAdd.Enabled = False 'don't want duplicate
End With
End If
End Sub