I have a multi select list box and a subform on a main form. I would like someone to select the values in the list box, click a button, and filter the subform based on their selections.
I currently have it where I click the button and it will store the selections in the list box in a string called "sTemp". The values in the string are numbers (associated with the key id). How can I then filter the subform based off of the string of numbers? The subform will also be filtered by a key id field. I would greatly appreciate any help!!
In the main form (frmAF) and provided that sTemp contains a comma separated list of values:
Private Sub TestMultiSelect_Click()
Dim sTemp As String
Dim varItm As Variant
For Each varItm In Me.lstOpCard.ItemsSelected
If Len(sTemp) > 0 Then sTemp = sTemp & ", "
sTemp = sTemp & Me.lstOpCard.Column(0, varItm)
If Len(sTemp) > 0 Then
Me.frmPassdown.Form.Filter = "[name of key id field] IN ( " & sTemp & " )"
Me.frmPassdown.Form.FilterOn = True
Me.frmPassdown.Form.Filter = ""
Me.frmPassdown.Form.FilterOn = False