H
Harmony
I have been working to try to get a list box to allow
multiple names selected and then those names selected, be
a criteria in my query. With the gracious help of others I
am pretty close, but haven't quite got it yet. I have the
following code on the LostFocus property of my list box.
This returns #Name? in my textwhere text box on my form,
but when I look in the control source it shows 'First Name
OR Second Name', which I think is what I want. So I guess
my question is, how do I get it to show up in my query
criteria?
Private Sub List28_LostFocus()
Dim strItems As String
Dim ctl As Control
Dim varItem As Variant
Set ctl = Me.List28
For Each varItem In ctl.ItemsSelected
strItems = strItems & ctl.ItemData(varItem) & "
OR "
Next varItem
'Trim the end of strSQL
strItems = Left$(strItems, Len(strItems) - 3)
txtWhere.ControlSource = strItems
End Sub
multiple names selected and then those names selected, be
a criteria in my query. With the gracious help of others I
am pretty close, but haven't quite got it yet. I have the
following code on the LostFocus property of my list box.
This returns #Name? in my textwhere text box on my form,
but when I look in the control source it shows 'First Name
OR Second Name', which I think is what I want. So I guess
my question is, how do I get it to show up in my query
criteria?
Private Sub List28_LostFocus()
Dim strItems As String
Dim ctl As Control
Dim varItem As Variant
Set ctl = Me.List28
For Each varItem In ctl.ItemsSelected
strItems = strItems & ctl.ItemData(varItem) & "
OR "
Next varItem
'Trim the end of strSQL
strItems = Left$(strItems, Len(strItems) - 3)
txtWhere.ControlSource = strItems
End Sub