By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 3,407 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

Can I use an expression as input to 'Like'?

P: 1
First, I am a totel novice, so I apologize if I use the wrong terminology. I am writing a simple query and want to use the 'Like' function to select only record that contain a certain string. When I use: Like "*Aerospace*" it works perfectly, but when I use: Like "*&[Expr1]&*" it doesn't work at all, even though Expr1 is equal to Aerospace. What am I missing?
Dec 8 '13 #1
Share this Question
Share on Google+
1 Reply

Seth Schrock
Expert 2.5K+
P: 2,941
You would need to to be
Expand|Select|Wrap|Line Numbers
  1. '*' & [Expr1] & '*'
Otherwise, your Expr1 is inside the quotes and it is taken for a literal string instead of like a variable that should be replaced by Aerospace.
Dec 8 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.