Form filter

triplee23

Newbie MS Access user
Local time
Today, 21:52
Joined
Apr 2, 2010
Messages
17
Hi,

I have created a navigation form with several subforms. When I call a subform using the navigation buttons, I use the WHERE CLAUSE to filter the result. Let's say I have a frm_members_list subform (continuous form based on table tblMembers) and that I have one navigation button with the caption ACTIVE and one caption NOT ACTIVE. The WHERE CLAUSE would then be [status]=TRUE for the subform returning all the active members and [status]=FALSE for the NOT ACTIVE. In a situation like this, I understand the MS Access basically just adds a filter to records the subform returns.

Then to the question:

The subform frm_members_list also has an unbound control (txtSearch) as a "search field". Basically what it does is that it adds a filter to the subform. The search field works fine, my only problem is that it searches among the whole members table (tblMembers) and totally resets the WHERE CLAUSE set by the navigation button. Is it somehow possible to ADD the filter input by the txtSearch field without "resetting" the filter that is already set by the WHERE CLAUSE [status]=TRUE/FALSE as described above?

Thanks for all answers!
 
Last edited:
Then to the question:

The subform frm_members_list also has an unbound control (txtSearch) as a "search field". Basically what it does is that it adds a filter to the subform. The search field works fine, my only problem is that it searches among the whole members table (tblMembers) and totally resets the WHERE CLAUSE set by the navigation button. Is it somehow possible to ADD the filter input by the txtSearch field without "resetting" the filter that is already set by the WHERE CLAUSE [status]=TRUE/FALSE as described above?

Thanks for all answers!
Then you've to include the criteria set by in the WHERE CLAUSE.
 
Hi,

Yes, that I understand. But after the subform has been loaded, how do I retrieve the WHERE CLAUSE once used when the navigation button what clicked?
 
Can't you use the form's open arguments (OpenArgs) to put and get the criteria from there?
To put it:

Code:
DoCmd.OpenForm(FormName,  View, FilterName, WhereCondition, DataMode,  WindowMode, [B][COLOR=Red]OpenArgs[/COLOR][/B])
To get it in the (sub)form:
Code:
Me.OpenArgs
 

Users who are viewing this thread

Back
Top Bottom