Solved

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

Posted on 2014-08-01
3
954 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

856 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