I have a query where I want to return all Clients that have a certain string in the name with wildcards on either side. So the input could be "Smith" and i want to return all things like "The John Smith Company" or "Smith and Bros". I want [Client] to be prompted so I set up the SQL like this:
PARAMETERS Client Text ( 255 );
SELECT *
WHERE (((tbl_IncomingChecks.Client) Like'%' + [Client] + '%')
ORDER BY tbl_IncomingChecks.Client;
The query is not returning any results. Please help
How about using
REGEXP
function in MYSQL?Or just simply use @client as the
REGEXP
to find all clients that contains this client name:As per OP's update on RDBMS as MS ACCESS
If you have a more sophisticated pattern you could use
Regexp
object within a MS Access UDF. However in current scenario you are better off withLIKE Concat('*',@client,'*')
Here is how you may use the above function in the query:
You are not using from in your statement
I feel like your problem is on the '+' operators shouldn't it read
This got me in DB2
MS Access uses * as a wildcard not %, so your query will be trying to match literal '%' characters. Use * instead unless you are using ADO.
http://office.microsoft.com/en-us/access-help/like-operator-HP001032253.aspx