Filtering query results.

simo7923

Registered User.
Local time
Today, 00:10
Joined
Jul 21, 2003
Messages
15
In one of the forms on my database the user ahs the ability to view the results of a preset query by clicking on the relevant button. The only problem is that they dont have the ability to filter the results as they so wish and currently only have the filtered view which i preset. Is there a way so thaey can apply any filter they wish....
 
One way to do this would be to generate a form based on your query, set it's default view to datasheet and paste it on to the form with your command button on. you shoud now see your query results on your main form as a sub-form. You should be able to sort each column, fillter on field contents etc. Be aware that you may have to protect the data as your user may be able to edit it.
 
What exactly do you mean by "the relevant button"? If it's a command button that you've set up. You could set up more command buttons for filtering, but most likely you won't be able to cover most of the users' possible choices.

The simplest ways to control filtering on forms are to right-click on the form itself or on a form field. Among the choices you get are (1) filter by selection, which shows only those records that have the currently selected value, (2) filter excluding selection, self-explanatory, (3) "filter for:", which allows you to type in a value to filter a field on, and (4) remove filter/sort. Those are the basic choices - they only allow you to work with one field at a time and with one filtering condition at a time.

A bit more advanced is to right-click on the form and choose "Filter by form" which will allow you to enter multiple conditions into multiple fields on the form, including "and" or "or" conditions.

A step up from this would be to user a menu driven filter-by-form that dynamically produces a custom SQL string. It's quite an undertaking if you've never done it, but it will be something your users will love. Here's a link to a post that has a downloadable example: Filter or setting the RecordSource. Here's another one: Adding a Search form to a database.
 
definetly gonna have to look into the last one mate......on theback burner at the mo though while i figure out a way to do this query builder form.......perservance will win hopefully....cheerz guys.....this is just what i need
 
looked at that sample database and i think that would be perfect. Am i right in thinking that the unbound text boxes are parameter entries for a query...just looking into how i can recreate this. viewing it on access xp but need to work it in '97
 
Am i right in thinking that the unbound text boxes are parameter entries for a query.
Yes. You wouldn't use bound boxes for queries.

Save it to Access 97 format. It should translate properly (in theory).
 

Users who are viewing this thread

Back
Top Bottom