Solved

How use two listboxes on a form to sort and filter a report

Posted on 2014-08-01
3
946 Views
Last Modified: 2014-08-01
I have a form that contains two listboxes.  They are both multi-select listboxes.  One of them is named listSortBy and the other one is named listFilterBy.  When I have selected for example two selections in the 1st listbox named listSortBy I want to pass that information on to a report and SORT the results based on the selections in the listbox in the order they were selected.  When I have selected for example three selections in the 2st listbox named listFilterBy I want to pass that information on to a report and FILTER the results based on the selections in the listbox.  

The report currently uses a query as its recordsource.  Do I need to somehow pass the selections from the listboxes on to the query?  In other words, sorting and filtering on the report have to be dynamic based on the selections in the two listboxes rather than static which could be determined in the report design.

Complicated, I know.  Is this all even possible?

--Steve
0
Comment
Question by:SteveL13
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 250 total points
ID: 40234739
See my Filtering by Multiple Selections Access Archon article:
http://www.helenfeddema.com/Files/accarch197.zip

Here is a screen shot of the form:
Filtering by listboxYou could also create a Sort string from the listbox selections.
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 40234744
You might not need to sort if the listbox items are already alphabetically sorted, as in my sample with state abbreviations.
0
 
LVL 45

Assisted Solution

by:aikimark
aikimark earned 250 total points
ID: 40234762
While the sortby shouldn't be too much of a problem, it isn't clear how the name of a column all by itself can be used for filtering.  Usually, filtering requires an expression including column name, comparator operator, and a value (or expression).
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question