Filter using a wild card

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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
 
Back
Top