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

Using a form's control as criteria with 'Like'

P: 2
Hello there, I have a dropdown on a form which i use as a criteria for a query. However the field being searched contains many entries - it holds a list of subject choices - so when i pass a value using forms![subforms]![controlname] it only returns those records that have that exact match.

For example, Field = Subject, values are Computers, Photography, Maths. My control/drop down if i select Maths, returns only those records that have Maths on its own. When i enter Like "*Maths*" straight into the criteria box in the query it returns perfectly - ie anyone who has Maths as ONE of their choices.

How do i apply the Like with the control reference in the criteria box of the Query. Any and all help would be much appreciated, thanks
Sep 17 '07 #1
Share this Question
Share on Google+
2 Replies


FishVal
Expert 2.5K+
P: 2,653
Hello there, I have a dropdown on a form which i use as a criteria for a query. However the field being searched contains many entries - it holds a list of subject choices - so when i pass a value using forms![subforms]![controlname] it only returns those records that have that exact match.

For example, Field = Subject, values are Computers, Photography, Maths. My control/drop down if i select Maths, returns only those records that have Maths on its own. When i enter Like "*Maths*" straight into the criteria box in the query it returns perfectly - ie anyone who has Maths as ONE of their choices.

How do i apply the Like with the control reference in the criteria box of the Query. Any and all help would be much appreciated, thanks
Hi, James.

Did you try smthng like
WHERE [FieldName] Like "*" & forms![subforms]![controlname] & "*"
?
Sep 17 '07 #2

P: 2
Hi, James.

Did you try smthng like
WHERE [FieldName] Like "*" & forms![subforms]![controlname] & "*"
?
Hi Fish

Haven't had a chance to use try that yet but just wanted to say thanks for the tip. I'll let you know how i get on.

All the best
James
Sep 19 '07 #3

Post your reply

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