View Full Version : Best Way to Create Filters on a Report


alan_mitchell
12-12-2008, 07:47 AM
Hi all,

Here's my situation.

I have a report (Report_1) based on a query (Query_1) which contains the following fields:

Staff name (text)
Manager name (text)
Location (text)
Client (text)
Key client (yes/no)
Date payment due (date)
Overdue (yes/no)
I want to create some sort of filtering interface at the top of the report, which lets users filter records from a particular location, staff member, overdue status etc.

The user should be able to filter only the fields he wishes, such as showing all clients from UK, or all clients belonging to Joe Bloggs that are overdue.

Any ideas on the best way to approach this?

Cheers,
Alan

Alansidman
12-12-2008, 07:58 AM
I would use a search form with a command button to execute the report based upon query. The search form would list the parameters for your fields in the query. Look at this web site on how to set up the search form and enable the query. From there, it should be easy to set up a command button to execute the report.

http://www.datapigtechnologies.com/flashfiles/searchform.html

Hope this helps you get where you need to be.

Alan

alan_mitchell
12-12-2008, 08:24 AM
Thanks Alan,

A few questions though:

1. When some of the fields are left blank, it doesn't filter for those fields. If the default value is "", how does it show all records? Why does it show records which contain data and not ones that are null?

2. Would this method work with combo boxes?

Cheers for your help,
Alan

Alansidman
12-12-2008, 09:03 AM
By using the like statement in your criteria, it will show the records. Mike explains that in the video.

As to combo boxes, why not. Use the unbound search field as a look up on a table. Then have the query look to that search box. If you need more information on how to do this, post back or look at combo boxes and the form filter presentations at www.Datapigtechnologies.com (http://www.Datapigtechnologies.com)

Alan