Dec 22 2011, 09:49 AM
I have a form frmTasks with a subform subfrmFindTasks
subfrmFindTasks is based on a query qryFindTasks
I use a set of combo boxes on frmTasks to pass through the values I want to filter on such as Project Manager, Designer, work type, status etc.
criteria in the query for the task status looks like this >>>>Like "*" & [Forms]![frmLogin]![frmTasks]![cboTaskStatus] & "*" And <>1011
I have never used list boxes before but I want to change the cboTaskStatus to lstTaskStatus.
There are 6 statuses
Void (this is 1011 which I don't want to display)
I created the list box and used some code I found to have it apply the filter on the "On Click" event.
It works but it doesn't play well with the other filters and the query.
Instead of applying the filter can I change the query criteria for the task status to>>>>Like "*" & [Forms]![frmLogin]![frmTasks]![lstTaskStatus] & "*" And <>1011?
I also want to set the default of the list box to return Created, Released and Assigned and show those 3 as selected. No idea where to start.
Last question, is there a way to specify the fore color of the selected items in the list box?
Hope I provided enough info. Thanks in advance.
Dec 22 2011, 09:51 AM
Are you saying that you want more than one item selected in the listbox simultaneously? If so, how will you use what (which) value(s) selected?
Dec 22 2011, 10:25 AM
Yes, I am looking to give the users to view multiple statuses at the same time.
It does work when I remove the criteria from the query and just allow the on click event to filter the results.
I need it to work within the query due to all the other filters.
Dec 22 2011, 11:28 AM
When you're dealing with a multi-select listbox, you can't get away with just "pointing" to the listbox. It has more than one value selected.
If you want to have users select multiple values from your listbox, then filter according to all selected values (i.e., "A" or "B" or ...), you'll have to write some code to get each of those selected values.
Dec 22 2011, 12:25 PM
How about this????
If I create a text box on frmTasks can I concatenate the selections from the list box with " OR " between them and then point the criteria of the task status in the query to the text box?
So if I select "Created" and "Released" the text box would read "Created" & " OR "& "Released". Or something like that.
If you could tell me how to get the selections from the list box into a single or multiple text boxes I think I could work with it from there if that makes sense.
Dec 22 2011, 09:16 PM
Generically, whether you use a listbox and identify each selected value to put directly into a SQL statement, or identify each selected value and put into a textbox, you'll still have to identify each selected value!
Check Access HELP for the For Each statement.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here