Combo box, sort selected items first then non selected items in Multi select combo box... Ms Access
How to sort selected items first then non selected items in Multi select combo box... Ms Access
Microsoft Access
Last Comment
crystal (strive4peace) - Microsoft MVP, Access
8/22/2022 - Mon
crystal (strive4peace) - Microsoft MVP, Access
what field decides if they are selected? What is the RowSource for your combobox?
if, for instance, you have a Yes/No field in your table that is keeping track of what is selected, you can add a column to the Query to sort and not show. True is -1. False is 0.
Sreeni Kambala
ASKER
SELECT tbl_Courseprofile.COURSE_NAME, tbl_Courseprofile.COURSE_ID
FROM tbl_Courseprofile
ORDER BY tbl_Courseprofile.COURSE_ID;
But I would like to sort on multi select items first.check box.
I would like to see selected 4 subjects on top then non selected subjects 2 subjects.see attached file. subject.jpg
crystal (strive4peace) - Microsoft MVP, Access
by example, I meant an example database. Thanks.
Where do you want to display the selections? If in a report or query, there needs to be a field to save if it is selected. I sometimes create a temporary YesNo field for processing for occasions like this.
thanks for posting a sample.
What are you going to do with this information? where do you want the sorted list to appear? Just write it to a control on the form and do nothing else? On a Report? If a report, or for remembering, there needs to be a field to store whether or not it is selected.
It appears to me that you perhaps need a TrainerCourses table with foreign keys relating to ID in the Trainer table (that is what should be called TrainerID -- I would call the text field TrainerCode) and COURSE_ID
Sreeni Kambala
ASKER
What are you going to do with this information? -> I use this information in edit mode, If I want to deselect one subject, it is easy to see selected items first.This will help when I have hundreds of records.
where do you want the sorted list to appear? --> Is it possible to sort in same combo box?
If not can you help me the code to populate selected items in below text box in 4 rows.
If I select 5 records, would like to see 5 rows in below text box.
crystal (strive4peace) - Microsoft MVP, Access
> "This will help when I have hundreds of records."
I see you are using a multi-select field but unless you are a programmer, this is a terrible thing to do because you will have to write code to process choices. Most developers don't use multi-select fields either. While it might seem like a cool quick way to get started, they create a lot of work. Read what I wrote about creating another table.
if, for instance, you have a Yes/No field in your table that is keeping track of what is selected, you can add a column to the Query to sort and not show. True is -1. False is 0.