Solved

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

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

763 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