Link to home
Start Free TrialLog in
Avatar of Richard Williams
Richard Williams

asked on

Locking in Filters

In my databases I use filters.  Every time I open a database I have to click on the "unfiltered" option at the bottom of the screen to activate the filter.    Is it possible to lock in the filter so it is active when I open the database?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Then simply use a form based on a query that does the filtering...

You did not give us any info on your "Filter", ...so try things like this:

SELECT f1, f2, f3
FROM YourTable
WHERE F2="Mike"

SELECT f1, f2, f3
FROM YourTable
WHERE F3=67

Then base the form on this query, ...then just open the form...
Filter will be applied automatically


JeffCoachman
Avatar of Richard Williams
Richard Williams

ASKER

FYI, I have a library database with two tables.   First is a list of my books; second is my reading list.  I have a form with a subform that uses a filter to show only the books I am reading.  It works nicely but every time I open the file I have to click to activate the filter.  While not a big deal, I would prefer it to be locked.  I will play with your suggestion in creating a query and then a form.
the the recordsource for the subform might be something like:
SELECT *
FROM tblReadingList
Where CurretlyReading=True

SELECT *
FROM tblReadingList
Where CurretlyReading="Yes"


I'm am sure you can get this sorted, ...keep me posted...

The kicker here is that the subform will *Always* display current books.

There is no "easy" way to remove the filter unless you change the recordsource...
There are other techniques, ...but I think that my first approach is what you wanted originally.

If you want something "ultimate"
Then you could create a "set up" form where it asks you how you want to open the sub form (All books, ...or current books), using this, you would set the default  to be "current", (so you don't have to do anything), ...but you could change it if you liked.

But this is something that could be considered later...
ASKER CERTIFIED SOLUTION
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fortunately I knew where to look, and made the change, and it works.    Thank you very much.
I've requested that this question be closed as follows:

Accepted answer: 0 points for DrRichardWilliams's comment #a41040700

for the following reason:

Solution simple yet based on his knowledge.    Much simpler than other suggestions.
No objection to the close, ...A few notes though, ...your question title was a bit confusing.
Instead of "Locking" the filter property on the form, you could just use a query to only show active books.
In this way you are not loading all the movies every time, ...then always using the form's resources to filter them out.
You also, then don't have to worry about setting any form properties. (as other settings may effect the FilterOnLoad property...

Then other side of this is that the query system may only be relevant if your recordset/recordsources are large.

JeffCoachman
I've requested that this question be closed as follows:

Accepted answer: 500 points for hnasr's comment #a41040508

for the following reason:

Accepting on behalf of the author
HNASR answered my question completely and his reply works great.  I have applied it in 2 different Access databases and it is OK.   So thank you very much.
Welcome!