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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query reading MultiSelect ListBox from a form 1

Status
Not open for further replies.

Rob999

Programmer
May 23, 2002
98
US
Using Access 2000, I'm having a real problem passing as a criteria condition the selections from a Multiselect List box on an open form. The list box is distinctly named and is on a Tabbed form, but it works when I select ONLY 1 item - just not any more than 1.

I've tried selecting directly from the listbox using the LocationID as the criteria (Access doesn't let me use the text - the itemdata selection isn't in the Build box) and I've tried updating a hidden list box from the selection to provide the value, but no go, though the hidden list box is the one that works with 1 selection.

Using the list box I can easily produce a comma delimited string of selections for the txtHiddenLocation.value like "item1, item2, item3". Some of the attempts I've put in the QBE Criteria line include:

"[Forms]![F_Admin3]![txtHiddenLocation]"
"In (Trim([Forms]![F_Admin3]![txtHiddenLocation]))"

I've tried various combinations with respect to the output string, such as including "'" delimiters, adding the "In(" prefix, and a bunch of other stuff.

Any ideas on capturing all selections in a list box for use as a query criteria? Thanks.
 
thread701-473531 can look at either of these posts. They approach the problem from two different directions.

Paul
 
Don't know why the other one didn't show up but here it is

thread181-36097

Paul
 
Thanks for the link Paul. I used a slightly different approach, but the "inStr" vs. "In()" was apparently what I needed to fix it. I'm giving your post a star, because it was very timely and your interaction with Bob Scriver (yeah, I gave him another star to add to his collection) answered some of the questions I had.

Thanks again, to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top