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

Multi-Select Listbox for Criteria

Status
Not open for further replies.

Ray1127

Programmer
Feb 22, 2002
231
US
I have a form with a multi-select listbox for the user to select 1 or more items for a report. The report is based on a query that uses that listbox in the criteria section. I've created a public function that takes the selected items in the list box and puts them into a string in the format "criteria1","criteria2" for however many items are selected. In the query on the criteria line for that field I have the following In (get_Criteria()) I verified that the function returns the data in the correct format but the query still returns 0 Data, even though I've verified that data does exist for the criteria I've selected. I've checked the string and it does put it into the format I want. What am I missing?
 
This just doesn't work. You can't use a solution like this. There are some alternatives in the FAQs for reports and/or queries.

I prefer to build the "[SomeFieldName] IN ('criteria1','criteria2',...)" and use it in the WHERE CONDITION of the DoCmdOpen.Report method.

Duane
Hook'D on Access
MS Access MVP
 
What I finally did was create a boolean function and passed the field data to the function. Then if the Field is one of those chosen it returns true else it returns false and in the Criteria of the Query I have it where that function = True. It works and fortunately that DB is only about 20 MB and won't grow very quickly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top