i had code like this :
i populate the listbox with RowSource, when listbox has data, those textboxes get value based on selection in listbox and it works perfectly, but when i re-populate the listbox and the listbox has NO data, those textboxes still show data before re-populate instead empty value or nullstring, i had try this :
but didn't works, it's like ListBox1_Change event not working properly, can someone explain this please.
thanks in advance.
VBA Code:
Private Sub ListBox1_Change()
With Me.ListBox1
If .ListCount > 0 Then
Me.TextBox2 = .List(.ListIndex, 0)
Me.TextBox5 = .List(.ListIndex, 1)
End If
End With
End Sub
i populate the listbox with RowSource, when listbox has data, those textboxes get value based on selection in listbox and it works perfectly, but when i re-populate the listbox and the listbox has NO data, those textboxes still show data before re-populate instead empty value or nullstring, i had try this :
VBA Code:
Private Sub ListBox1_Change()
With Me.ListBox1
Me.TextBox2 = vbNullString
Me.TextBox5 = vbNullString
If .ListCount > 0 Then
Me.TextBox2 = .List(.ListIndex, 0)
Me.TextBox5 = .List(.ListIndex, 1)
End If
End With
End Sub
but didn't works, it's like ListBox1_Change event not working properly, can someone explain this please.
thanks in advance.