I have 2 unbound list boxes on my form.
The first list box is based off a query and lists the States.
I would like the second list box to be populated with cities based off of what states the user selects.
I can not get my code to work. Can anyone help?
Private Sub lstStates_AfterUpdate()
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
For Each varItem In Me!lstStates.ItemsSelected
strCriteria = strCriteria & ",'" & Me!lstStates.ItemData(varItem) & "'"
Next varItem
strCriteria = Right(strCriteria, Len(strCriteria) - 1)
strSQL = "SELECT * FROM tblStatesCites " & _
"WHERE tblStatesCites.States IN(" & strCriteria & ");"
lstCities.ListSource = Array(strSQL)
End Sub