I'm new to Access and I'm trying to create a searchable form. You select the field you want to search by using a drop down list, type the text into a text box and then search.
The results from your field combo box and the text box can be combined to create a filter that can be applied to the form.
Code:
dim strFilter as String
If Not IsNull(Me.cboField) and _
Not IsNull(Me.txtSearch) Then
strFilter = "[" & Me.cboField & "] = """ & _
me.txtSearch & """""
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.FilterOn = False
End If
This assumes your fields are text and you want an exact match. If you want different, you need to specify it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.