Filter Continuous Form

mafhobb

Registered User.
Local time
Today, 15:19
Joined
Feb 28, 2006
Messages
1,249
I am trying to filter a bound, continuous form on load so it displays only the records with a specific field containing a string somewhere in the field value. This is what I have:

Code:
    If Me.OpenArgs <> "" Then
        strFilter = Me.OpenArgs
        Me.Filter = "[AutoEmailCode] like & 'strFilter'"
        Me.FilterOn = True
    End If

strFilter is a string.

I get a syntax error.

Any ideas?

Thanks

mafhobb
 
Your quotes are not quite right;
Code:
If Me.OpenArgs <> "" Then
        strFilter = Me.OpenArgs
        Me.Filter = "[AutoEmailCode] like [COLOR="Red"]'" [/COLOR]& strFilter [COLOR="red"]& "'"[/COLOR]
        Me.FilterOn = True
    End If
 
If Me.OpenArgs <> "" Then
strFilter = Me.OpenArgs
Me.Filter = "[AutoEmailCode] like " & strFilter
Me.FilterOn = True
End If
 
Thanks Minty, but no luck yet... When I modify the code as you show I get an empty continuous form. It looks like the "Like" parameter is not working.
 
You might need Like '*" & strFilter & "*'"if you need wildcard matches to work
 
This is what did it!

Code:
    If Me.OpenArgs <> "" Then
        strFilter = Me.OpenArgs
        Me.Filter = "[AutoEmailCode] like '*" & strFilter & "*'"
        Me.FilterOn = True
    End If

Thanks a bunch!

mafhobb
 

Users who are viewing this thread

Back
Top Bottom