UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> List Box Vs Combo Box    
 
   
Knuckles
post Dec 22 2011, 09:49 AM
Post #1

UtterAccess Veteran
Posts: 407
From: New Jersey



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
Created
Released
Assigned
Completed
Canceled
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.

Knuckles




Go to the top of the page
 
+
Jeff B.
post Dec 22 2011, 09:51 AM
Post #2

UtterAccess VIP
Posts: 8,167
From: Pacific NorthWet



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?
Go to the top of the page
 
+
Knuckles
post Dec 22 2011, 10:25 AM
Post #3

UtterAccess Veteran
Posts: 407
From: New Jersey



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.
Go to the top of the page
 
+
Jeff B.
post Dec 22 2011, 11:28 AM
Post #4

UtterAccess VIP
Posts: 8,167
From: Pacific NorthWet



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.
Go to the top of the page
 
+
Knuckles
post Dec 22 2011, 12:25 PM
Post #5

UtterAccess Veteran
Posts: 407
From: New Jersey



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.
Go to the top of the page
 
+
Jeff B.
post Dec 22 2011, 09:16 PM
Post #6

UtterAccess VIP
Posts: 8,167
From: Pacific NorthWet



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.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 09:29 PM