In Excel, the Like operator is used with ? and * to designate one or many missing characters, respectively. Someone recently asked me about using the Like operator in MSQuery. Since I didn’t know off the top of my head, I went to the help file. If there’s anything in the help file about this, I couldn’t find it.
In MSQuery, Like works just how you’d expect it to, that is if you’ve used Like in some other program. The difference is that MSQuery’s Like appears to have only one wildcard character, namely the percent sign (%). It stands in for multiple characters, similar to the asterisks (*) in Excel. The criterion
will return all the records that start with”KU”. Like appears to be case insensitive. That is, the above criterion would also return records that start with “ku”, “Ku”, and “kU”.
To use Like in a parameter, simply concatenate the percent sign with your parameter with the ampersand (&). For example, to find all the customers whose CustomerID started with ‘S’ and whose City contained a certain letter, you might set up your criteria like this:
This uses the Northwind sample database’s Customer table. I entered an ‘a’ when the parameter prompted me and got all the CustomerIDs starting with ‘S’ whose City contained an ‘a’.