How do I put a wildcard into the truepart of an IIf statement of an access query criteria?
February 11, 2009 7:32 AM
Subscribe
How do I put a wildcard into the truepart of an IIf statement of an MS Access 2003 query criteria?
Unfortunately, I cannot make changes to the data structure or tables because my company uses a strictly-controlled data entry frontend (iMIS).
Here's what I'm trying to do: use an option group on a form to pick criteria 1, 2 or both. I have this in my query criteria currently:
IIf([Forms]![Simple Selector]![OptGrpMemType]=1,"MRD",IIf([Forms]![Simple Selector]![OptGrpMemType]=2,"NRD",IIf([Forms]![Simple Selector]![OptGrpMemType]=3,X,)
For X I have tried:
Like "?RD"
Like "*RD"
Like "[MN]RD"
"""MRD"" OR ""NRD"""
Neither work in the IIf statement because they apparently don't accept wildcards, so it looks for "[asterisk]RD" instead of "[Any Character]RD".
There's probably another way to do this, but at this point I'm annoyed that I can't figure out how to use wildcards in the truepart or falsepart statements.
Google searches have been inconclusive; the best result was a link to ExpertsExchange, which is a members-only site.
posted by JeremiahBritt to computers & internet (9 comments total)
RIGHT([FieldNameHere],2) = RIGHT([Field2NameHere],2)
This would be true if the last 2 characters are the same in each each expression.
Also, if you get to an sexpertsexchange page directly from a google link, scroll all the way down to the bottom of the page to see the answers
posted by Zetetics at 7:57 AM on February 11