Hi, I have created a form with 2 unbound multi-select listboxes and want to run a query based on what was selected in both listboxes. I know I need VB code to run this but can't seem to find the right code. (I am new to VB)
Please help!!
Hi, I have created a form with 2 unbound multi-select listboxes and want to run a query based on what was selected in both listboxes. I know I need VB code to run this but can't seem to find the right code. (I am new to VB)
Please help!!
There is a lot of flexibility with VBA but I used a button that when clicked ran this code:
Me.Filter = "[YourField] = '" & ListBox.Value & "' AND " & "[YourBoolean] = YourBoolean.Value"
Me.Filter is the object that filters the form.
[YourField] is the field in your table/form that you want filtered
ListBox.Value is the control holding the value you want to filter by
[YourBoolean] is if you want the secondary filter criteria to be based on a Yes/No from your table, but you can just use a second text field here if you want.
YourBoolean.Value is the value stored in the control that you wish to be your secondary filter criteria.
I hope that was clear.