473,722 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Filter Field] = " & 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 2843
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 LinkMasterField s/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*******@yaho o.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.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
7850
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 from queries. Let me just add that Allen Browne excellent article about this subject may not apply to this scenario on an elementary level. (Here's the link to the article; Filter a Form on a Field in a Subform -...
0
6474
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 report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
2
9799
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 divisions of the company, and a subform that is linked so that it displays all the jobs within the division in the parent form. I also want the ability to filter the subform, so the users can pick out a bunch of common jobs easily. I did this using a...
3
6614
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 the text value is on a different table. The me.filter is then a text instead of the id-number from the lookup table. This causes the report to prompt for the parameter. How do I get by this problem? Do I need to create a temporary table? I rather...
2
4030
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 by form" feature. When the user tries to use Filter by form a messagebox is displayed: "There are too many controls in this form to perform a filter by form", after that,when the user exit the Filter by Form mode, Access crash, displaying a...
16
5133
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. And K&R2 mentions "signed extension" everywhere. Reading some old clc posts, I've beginning to realize that these books are over-generalizing the topic. I am just wondering what the difference between the following pairs of terms are: 1)...
2
3376
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 for the web site are held in a database and all the labels, buttons etc are populated at run time in the Page_Load handler. The retreval of the strings from the database is all
3
5757
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 added by that process. Doing child = os.popen("ls --color=auto") output = child.read()
3
3298
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 preserving rule:- when signed and un signed objects meet in an expression, the result is
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5995
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.