You might try using code as in the sample database.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
- Show quoted text -
Allen,
Pleaseeee help me on this, I have to send out the final database to
the end users tonight and I need to include a search form to look up
the products in the pricelist.
My form search is based on a query which has five fields that i'm
quering on with the following in the criteria of each
Like "*" & [forms]![productsearchform].[filtername] & "*"
In the form's search comman on click I have the following:
Option Compare Database
Option Explicit
Private Sub cmdFilter_Click()
Dim strWhere As String
If Not IsNull(Me.QDivision) Then
strWhere = strWhere & "([divison] Like ""*" & Me.QDivision &
"*"") AND "
End If
If Not IsNull(Me.QBrand) Then
strWhere = strWhere & "([IREF04] Like ""*" & Me.QBrand & "*"")
AND "
End If
If Not IsNull(Me.QItemDesc) Then
strWhere = strWhere & "([ProductName] Like ""*" & Me.QItemDesc
& "*"") AND "
End If
If Not IsNull(Me.QPC) Then
strWhere = strWhere & "([Pc] Like ""*" & Me.QPC & "*"") AND "
End If
If Not IsNull(Me.QPCDesc) Then
strWhere = strWhere & "([pcdesc] Like ""*" & Me.QPCDesc &
"*"") AND "
End If
Me.Filter = strWhere
Me.FilterOn = True
End Sub
I get a compile error 2448 on Me.filter = strWhere and then
me.filterOn = true.
Thank you