Hi,
I have built a continuous form that's basically a big list different items. I have comboboxes at the top that allow you to filter the list to find the items you want.
I have it set up so after one combobox is updated, a string is built using the text in each combobox, then that string is applied to the form as a filter.
It's working great, but there's one extra thing I want to add.
For example, there's a description field in my list. If I type "Blue" into the combobox for that field, I want my form to display every record with "Blue" anywhere in the description field.
If I type "Green" I want the following records to display:
Green
A green backpack
Greensman
I know that I need to search for records using a wildcard, but I'm not sure how to format it.
Here's the relevant portion my code for reference:
I have built a continuous form that's basically a big list different items. I have comboboxes at the top that allow you to filter the list to find the items you want.
I have it set up so after one combobox is updated, a string is built using the text in each combobox, then that string is applied to the form as a filter.
It's working great, but there's one extra thing I want to add.
For example, there's a description field in my list. If I type "Blue" into the combobox for that field, I want my form to display every record with "Blue" anywhere in the description field.
If I type "Green" I want the following records to display:
Green
A green backpack
Greensman
I know that I need to search for records using a wildcard, but I'm not sure how to format it.
Here's the relevant portion my code for reference:
Code:
Private Sub descriptionCombo_AfterUpdate()
Dim strFilter As String
strFilter = ""
If Me!descriptionCombo & vbNullStr <> vbNullStr Then
strFilter = strFilter & "AND [Description] = '" & Me.descriptionCombo & "'"
End If
'End of combobox checks
If strFilter <> "" Then
'Cleaning string, trimming off beginning "AND"
Me.Filter = Mid(strFilter, 4)
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
End Sub