Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using IN in a parameter query 1

Status
Not open for further replies.

Shairal

Technical User
Oct 13, 2005
25
0
0
US
There’s probably a real simple answer to this, but I just can’t figure it out. I have a basic query with a parameter prompting for office locations. I want the end user to be able to select either a single or multiple locations – I thought IN would work perfectly but I'm unable to get any results back using it.
I’ve tried
IN([enter location]), IN[(enter location)], IN[enter location], etc … none of these return data. Yet the simple [enter location] works every time.

Any assistance is greatly appreciated!
 
Unfortunately, entering something like

1,2,3,4 for [Enter Location]

with the statement
Code:
WHERE myField IN ([Enter Location])
results in the SQL
Code:
WHERE myField IN ("1,2,3,4")
i.e. it is attempting to match myField to the String and not to the comma-separated values in the string.

You might try
Code:
WHERE InStr(1,[Enter Locations] & ","), myField & ",") > 0

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top