Hello I'm trying to make a form where, accordingly to what is selected in a ComboBox, to show some words in a list, the problem is the VBA code I've developed it doesn't allow me to change the items in the ComboBox, being stuck in the first option that appears in the ComboBox, my code is:
Option Compare Database
Option Explicit
Private Sub Combo2_Click()
Me.Combo2 = Me.Combo2.ItemData(0)
Combo2_AfterUpdate
End Sub
Private Sub Combo2_AfterUpdate()
Me.List4.RowSource = "SELECT Nome " & _
"FROM tbl1_Herdeiros " & _
"WHERE ID_Herancas = " & Nz(Me.Combo2)
Me.List4.Requery
Me.List4 = Me.List4.ItemData(0)
End Sub
Can anyone explain me what might be wrong with my VBA code?