473,835 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ApplyFil ter '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 18750
b2******@or.blm .gov (Brian Newman) wrote in
news:3a******** *************** **@posting.goog le.com:
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.ApplyFil ter
'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******@gener ation.net> wrote in message news:<f0******* *************** ********@news.t eranews.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
2474
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 filled from a database. The generated static pages are then streamed into FreeTextbox editor for user edits. I want to use a variable for the filename since each user will need a separate temporary template page. The system works fine for a...
4
1645
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 to filter on the current school year. They work seperatly, but not together. I would like a user, if they want, to be able to apply both filters at once -- (only a certain school year and only a certain student). Help?
3
2484
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 set buffer=false on a large page). Now the problem: If I turn on buffering on a large page, the page output (to the browser) is correct a few times (sometines just once, sometime 2-3 times...on the same page) then I seem to either lose data...
0
2519
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 from the database a set of data to populate the itself with. Now to make this control as reusable as possible I also added a new property to this Custom DropDownList. With the goal being that this property would be used with the DataView...
1
2286
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 can add a filter sub to the collection code but I am not sure how to find which property to use. Say if my custom object is like this: Person ID FirstName LastName
2
6699
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 as a filter so that multiple reports are created. This is now generating a PDF report, but I need to change it to RTF documents. My question is, since I can't create an RTF using open report, is there a way to use the strFilter with the OutputTo...
3
1507
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 End Sub Above code fails - Access doesn't like the 4th line. What change need I make to open the report with desired filter spec?
4
5451
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 Records: " & Me.Recordset.RecordCount)
1
2694
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 58419-58421 meena 300.00 58422-58424 Tan 300.00 58425-58427
2
7844
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 different), records. I created in the Sub-reports Filter property the following: "='Reports!!'" And " = 'Reports!!'" Text15 and Text16 are text boxes in the sub-report where their Data property is hardcoded. Text15's is: ="West" and Text16's...
0
9800
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
10802
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
10516
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
10557
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
10225
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
6961
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();...
0
5630
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5802
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
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

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.