473,414 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Preserving a Form's Filter

I have a form (no underlying record set) that has two separate
sub-forms on it.
Each sub-form has data from two different tables.
Above each sub-form there is one unbound combo box with a SQL record
source that returns an ID field and a Text field.
Next to each combo box is two buttons, one that 'Applys' the filter of
the sub-form to the value in the combo box and one that 'Clears' the
form's current filter.
When the click event of the "Apply Filter" button fires the following
code executes.....

[Subform1].Form.Filter = "[Subform1_FilterField] = " & Combo1.Value
[Subform1].Form.FilterOn = True

This causes Subform1 to show all records that match the Combo1 value.
Works fine.

When the click event of the "Clear Filter" button fires the following
code executes.....

[Subform1].Form.FilterOn = False
or
[Subform1].Form.Filter = ""

This causes Subform1 to show all records.
Works fine.

The same behavior happens with the second subform, combo box and
buttons. Just a different record set. Everything ok.

The problem is when I 'filter' the first subform and 'filter' the
second subform and then 'clear' anyone of the filters by clicking a
"Clear Filter" button, both subforms show all records.
The expected behavior is to have only one subform to show all records,
the one whose "Clear Filter" button was clicked, not both subforms!

Another funny thing, during trouble shooting, is, if Subform1 is
filtered and Subform2 "Clear Filter" button is clicked, nothing happens
to Subform1 as expected.

So it would seem that you have to apply both filters before the act of
clearing one is able to clear both.

Note, in my experience this happens to all subforms (even more than 2)
on the main form.
I need to have the other subforms remain in their filtered state.

So the question is, is there a way to clear a subform's filter without
clearing other subforms' currently applied filters?
I hope this was clear enough.
TIA

Nov 13 '05 #1
2 2812
There are major flaws in the way Access handles the Filter and OrderBy
properties of forms with subforms. I assure you the problem is with Access
and not with you.

For more info on other ways that these bugs manifest, see:
Incorrect filtering of forms and reports
at:
http://allenbrowne.com/bug-02.html
The article demonstrates four bugs, not exactly the same as yours, but the
same kinds of issue.

The best workaround might be to set the RecordSource of (one of) the
subforms instead of using filters. Unfortunately, when you do that Access
will decide to reassign the LinkMasterFields/LinkChildFields propeties of
the subform control to whatever it feels like, so you will probably have to
reassign those properties as well to get a consistent result.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<ce*******@yahoo.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
[snip]

The problem is when I 'filter' the first subform and 'filter' the
second subform and then 'clear' anyone of the filters by clicking a
"Clear Filter" button, both subforms show all records.
The expected behavior is to have only one subform to show all records,
the one whose "Clear Filter" button was clicked, not both subforms!

Another funny thing, during trouble shooting, is, if Subform1 is
filtered and Subform2 "Clear Filter" button is clicked, nothing happens
to Subform1 as expected.

So it would seem that you have to apply both filters before the act of
clearing one is able to clear both.

Note, in my experience this happens to all subforms (even more than 2)
on the main form.
I need to have the other subforms remain in their filtered state.

So the question is, is there a way to clear a subform's filter without
clearing other subforms' currently applied filters?

Nov 13 '05 #2
Thanks mate,

I just set the filter to 'True', which results in all records returned.
It's what I want, with the only exception that the record counter says
'(filtered)' after the numbers. It's not a real problem, but I dont
want users to think that there may be more records available. I'll have
to take what I can get.
Cheers!

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
2
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
2
by: Lenin Torres | last post by:
Hi everybody I have an Union Query that works fine. I used this query as the RecordSource for a Form. That Form is used as a subform in another form. Everything works fine, except for the "Filter...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
2
by: Pete | last post by:
Hi all... I sincerly hope one of the MS guys can clear this up for me... First some background... Ok, I have a web site which is fully translatable into several languages. All the strings...
3
by: zeezlo | last post by:
Hi everyone I would like to get the output of a shell process on Linux (eg, "ls --color=auto") run via os.popen(), filter it and then output parts of it while preserving any original coloring...
3
by: sophia.agnes | last post by:
Dear all, I was going through the book "C a software engineering approach by darnell & Margolis" there was a section named sign preserving vs value preserving it is as follows sign...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.