Wildcards with Form Filters (1 Viewer)

tinyevil777

Registered User.
Local time
Today, 00:33
Joined
Dec 10, 2010
Messages
137
Hello,

Dead simple one i'm sure... I'm using the following code to filter a subform depending on the contents of a text box:

Code:
If Nz(Me.SrchDescription, "<All>") > "<All>" Then  'Invoice Description
    If Len(Nz(strFilter)) > 0 Then strFilter = strFilter & " And "
    strFilter = strFilter & "Descr LIKE" & "'" & "*" & Me.SrchDescription & "*" & "'"
    bFilter = True
    End If

However, this is not working. It returns no records.

Example data:

South
South Shields
Liverpool South
North
East

If i enter 'South' into the text box, I would expect the following data to be returned:

South
South Sheilds
Liverpool South

I'm sure it's just a case that my syntax is wrong in the code, however i've gone as far as i possibly can, and am seeking anyone's valuable help!

Thank you all.
 

mdlueck

Sr. Application Developer
Local time
Yesterday, 20:33
Joined
Jun 23, 2011
Messages
2,631
Code:
If Nz(Me.SrchDescription, "<All>") > "<All>" Then  'Invoice Description

Is this really a valid greater-than comparison?

Code:
    strFilter = strFilter & "Descr LIKE" & "'" & "*" & Me.SrchDescription & "*" & "'"

I would simplify this line down by not concatenating static strings together... something along the lines of...

Code:
    strFilter = strFilter & "Descr LIKE '*" & Me.SrchDescription & "*'"
 

Users who are viewing this thread

Top Bottom