473,396 Members | 1,891 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,396 software developers and data experts.

Q: How to set a filter on a sub-form?

I've got what is actually a triple-layer nested form. That part works
fine. I've got the first subform related by the right key field to
the main form, then I've got the second subform related to the first
subform by their shared key field.

Browsing in that arrangement works beautifully.

Now, the third tier is the line item data, and there are a number of
different kinds of line items sharing the same table -- specifically,
there are records for Trees, Stumps, Ground Cover, Sapling clumps, and
so on. It's just as if they were different items in an inventory.

I have a number of buttons on the third tier form that I want to use
to filter those data records -- the first button shows only "Trees",
and so on. I'm using "DoCmd.ApplyFilter 'FilterName'", where
'FilterName' is a query on the third tier table.

Running the form stand-alone, the filters work fine (though they
filter on the entire table, of course).

Running the form nested, the DoCmd keeps wanting to apply the filter
to the currently active form, which is always the topmost form, i.e.
the first tier. So it asks for field values that don't exist and then
craps out.

I've tried every method I could think of for setting focus, setting
the active window, etc., and nothing seems to activate the third tier
window to do the filter and then return to the top level.

If I actively click in the third tier window and then apply the
filter, it works, but the first tier and second tier go blank because
they're out of context.

Any thoughts?
Nov 12 '05 #1
2 18718
b2******@or.blm.gov (Brian Newman) wrote in
news:3a*************************@posting.google.co m:
I've got what is actually a triple-layer nested form. That
part works fine. I've got the first subform related by the
right key field to the main form, then I've got the second
subform related to the first subform by their shared key
field.

Browsing in that arrangement works beautifully.

Now, the third tier is the line item data, and there are a
number of different kinds of line items sharing the same table
-- specifically, there are records for Trees, Stumps, Ground
Cover, Sapling clumps, and so on. It's just as if they were
different items in an inventory.

I have a number of buttons on the third tier form that I want
to use to filter those data records -- the first button shows
only "Trees", and so on. I'm using "DoCmd.ApplyFilter
'FilterName'", where 'FilterName' is a query on the third tier
table.
I've tried every method I could think of for setting focus,
setting the active window, etc., and nothing seems to activate
the third tier window to do the filter and then return to the
top level.

Any thoughts?


Instead of using a stored query to filter, put a little bit of code
behind the buttons in the subform.

example
sub Btn_Tree_Click
me.filter = "[Item] = 'tree'"
me.filteron = true
end sub

sub Btn_All_Click
me.filter = ""
me.filteron = false
end sub

Bob Q
Nov 12 '05 #2
Bob Quintal <bq******@generation.net> wrote in message news:<f0******************************@news.terane ws.com>...
Instead of using a stored query to filter, put a little bit of code
behind the buttons in the subform.


That works beautifully. Thanks.
Nov 12 '05 #3

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

Similar topics

1
by: Lou | last post by:
I'm using the Response Filter Class in MS KB article 811162 (http://support.microsoft.com/default.aspx?scid=kb;EN-US;811162) to generate a static htm page from an asp.net template page being...
4
by: crispywafers | last post by:
Hi, Is it possible to filter ontop of the current filter being applied to records? This seems like it should be easy? I have two drop down boxes-- one to filter on a student's last name, one...
3
by: Brad | last post by:
I have a response filter which injects "standard" html into my pages. The filter works fine when the initial stream is small enough not to buffer...or....if I have a large unbuffered stream (i.e. I...
0
by: RyanG | last post by:
when the value that determines the filter is databound?? I am trying to make a DropDownList for a set of data that I use a lot throughout my project. So I extended the DropDownList to retrieve...
1
by: Stanley | last post by:
Hello all, I have a custom collection that I am using to fill a DropDown list that I need to filter out items based on another dropdown list. My problem is the actual filter in the collection. I...
2
by: Thall | last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation The following code loops thru a sales report, using the sales rep ID...
3
by: MLH | last post by:
Private Sub Command0_Click() Dim MyReport As Report MyReport.Name = "rptStateOfAffairs" MyReport.Filter = "ClusterName = 'Auto Company, Inc'" Me.FilterOn = True DoCmd.OpenReport MyReport.Name...
4
by: Sheree | last post by:
I have some Access 2003 VBA code that looks like this: Private Sub SubName() Me.FilterOn = True Me.Filter = "" ' Me.FilterOn = False ' Me.Requery x = msgbox("Filter Cleared. Number of...
1
kirubagari
by: kirubagari | last post by:
Hai experts, How to duplicate the data from 1 excel sheet to another excel sheet 2. Lets say Name Voucher Value Voucher Number lee 300.00 ...
2
by: Charles Coleman | last post by:
I have several sub-reports in an Access report. All of the sub-reports use the same Query. I want to create a Filter so when the main report is opened, each sub-report shows is respective, (but...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.