G
Guest
I have a form with two multi select list boxes. I want to be able to use the selection made in the list boxes to act as criterion for the query behind it's sub-form.
I can get it to work for one list box with one selected item. However, I cannot get it to work when multiple items are selected. nor can I cancatenate the values of one list box with another.
Here is 1 of the coding that I was trying to use:
********
Private Sub List0_AfterUpdate()
'Returns a listing of the items selected from the list box (query criteria format)
Dim varItem As Variant
Dim strList As String
With Me!List0
If .MultiSelect = 0 Then
strList = .Value
Else
For Each varItem In .ItemsSelected
strList = strList & " OR " & """[Lead Signature] Like '" & .Column(0, varItem) & "'"
Next varItem
End If
End With
strList = Right(strList, Len(strList) - 4) & """"
MsgBox strList
Me.Lead_tool_03_subform.Form.Filter = strlist
Forms![Lead Summary Drawing Information frm]![Lead tool 03 subform].Form.FilterOn = True
End Sub
********
can someone please spell it out for me. I've already spent 1.5 day on this to get nowhere. Is there a sample database somewhere that I could down load to greatly inspire myself?!
thanks
Daniel
PS: Don't like the new format of the forum! I find the postings messy ... what happened to the spacings and enters .... not much of an improvement in my opinion
I can get it to work for one list box with one selected item. However, I cannot get it to work when multiple items are selected. nor can I cancatenate the values of one list box with another.
Here is 1 of the coding that I was trying to use:
********
Private Sub List0_AfterUpdate()
'Returns a listing of the items selected from the list box (query criteria format)
Dim varItem As Variant
Dim strList As String
With Me!List0
If .MultiSelect = 0 Then
strList = .Value
Else
For Each varItem In .ItemsSelected
strList = strList & " OR " & """[Lead Signature] Like '" & .Column(0, varItem) & "'"
Next varItem
End If
End With
strList = Right(strList, Len(strList) - 4) & """"
MsgBox strList
Me.Lead_tool_03_subform.Form.Filter = strlist
Forms![Lead Summary Drawing Information frm]![Lead tool 03 subform].Form.FilterOn = True
End Sub
********
can someone please spell it out for me. I've already spent 1.5 day on this to get nowhere. Is there a sample database somewhere that I could down load to greatly inspire myself?!
thanks
Daniel
PS: Don't like the new format of the forum! I find the postings messy ... what happened to the spacings and enters .... not much of an improvement in my opinion