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
Sreeni KambalaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
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.
0
Sreeni KambalaAuthor Commented:
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.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
Would you post an example?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Sreeni KambalaAuthor Commented:
I would like to see selected 4 subjects on top then non selected subjects 2 subjects.see attached file.
subject.jpg
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
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.
0
Sreeni KambalaAuthor Commented:
ATTACHED DB,
sample.accdb
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
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
0
Sreeni KambalaAuthor Commented:
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.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
> "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.
0
Sreeni KambalaAuthor Commented:
Storing the records in trainer profile table, column name COURSE_NAME.Please verify.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you are using a multi-select field -- much better to use a related table.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
Please re-read my previous comments -- I may have edited them after you read them.  thanks.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
Also, it is not possible to filter choices for a multi-select combobox if, for instance, a trainer just teaches certain types of classes.

I see you started with a template.  My recommendation, sad to say, it not to use the templates.  Better to build it yourself so it makes sense and works for a serious business.  To get started, read this free short book:

 Access Basics
http://www.AccessMVP.com/strive4peace
Free 100-page book that covers essentials in Access
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.