Filter using a wild card

R

richardb

I am trying to make wildcard expressions work for filtering . To pass
everything, I tried Filter = "strFC = '*'" but that passed nothing. I can't
find this documented. Can i use wildcards as filters?
 
M

Marshall Barton

richardb said:
I am trying to make wildcard expressions work for filtering . To pass
everything, I tried Filter = "strFC = '*'" but that passed nothing. I can't
find this documented. Can i use wildcards as filters?


Yes, but you must use the Like operator instead of =

Note that using Like "*" will not match Null values.

It is far better to not use a filter than to use a filter
that tries to match everything.
 
R

richardb

Marshall,

Thank you for that tip. I was trying to set up two filters, where I could
drop one part of the filter by changing its match to "*". For example,

If This_Condition then filter1 ="*"
Filter = "Var1 Like '" & filter1 & "' AND Var2 Like '" & filter2 & "'"
This would just filter on Var2.
But intead I wrote a script using IIf to build the Filter text string to
just Filter = "Var2 = '" & filter2 & "'" in the event that This_Condition
was true, which, based on your advice, is probably the better technique.

Richard B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top