Solved

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

Posted on 2014-08-01
3
928 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now