Would somebody be able to point me in the right direction?
I am in need of gabbing a vbcode to do the following:
I need to filter a listbox that will be contained in a form, over a ton of different text boxes/combo boxes.
I've attached a file of the form draft... the contents of the form are kinda' all over the place right now. But it's for reference on all the things that I'm going to need filtered on the listbox I'm going to put on the same form.
I know the answer lies in a loop of sorts:
Dim vItem As Variant
Dim lngLen as Long
With Me.MyListbox
For Each vItem In .ItemsSelected
If Not IsNull(vItem) Then
strWhere = strWhere & """" & .ItemData(vItem) & """, "
End If
Next
End With
lngLen = Len(strWhere) - 2 'Without trailing comma and space.
If lngLen > 0 Then
strWhere = "[MyField] IN (" & Left$(strWhere, lngLen) & ")"
End If
But I am very much a beginner when it comes to VB, so if someone wouldn't mind helping me translate what I need to get done, it would be greatly appreciated.
Start Free Trial