473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Subform filter restricts Parent?

"Rick Brandt" <ri*********@ho tmail.comwrote in news:bPnKj.456$ %41.325
@nlpi064.nbdc.s bc.com:
diogenes wrote:
>I'm using Access 2003 and reviving some development on an application.

I have an Orders form with a Products subform. 1:n relationship
between tables.

Is there any way to programmaticall y set a Filter on the Products
subform and have it result in a filtering of the Orders form? The
forms are bound and Master/child key binding set in code.

So far I have been able to filter the subform (Products) but the
result is that the main Orders form displays blank product records
(in the subform) for those records that are filtered out (instead of
filtering out both subform and form records).

I know that it works the other way (filter main form, subform gets
filtered) but I was hoping that there is some way to go "in reverse."

Thanks for any suggestions.

You can't make a filter on the subform affect the main form, but you can
apply a filter to the main form that finds records containing certain
products. You just need a filter that uses an IN() clause.

Assuming that the common field is OrderNumber use a filter like...

OrderNumber In(SELECT OrderNumber FROM Products WHERE Product =
'SomeProduct')

Note: I have had cases where such a filter made the data in the form
non-editable.
I used this approach, and it works a treat!

ID In(SELECT Order_ID FROM orderitems WHERE NAME = 'product')

I've not used an In clause before. Thanks a lot for the education.
Jun 27 '08 #1
0 1684

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

Similar topics

2
9796
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...
2
2069
by: Ima Lostsoul | last post by:
Access XP Access 2002 format. I have a subform on a tab control. The subform has the following code (error trapping removed to make post shorter)... When I close the parent form it goes 100% as designed UNLESS I have used one of the sort buttons to sort the sub form on any given field. If I do sort, there is a delay fo about 5 seconds until after the parent form closes and the previous form re-opens. It appears that there may be...
6
2029
by: Ray | last post by:
I have a main form with a subform. The main form has a combo box which lists all the clients which in turn are displayed in the subform. The subform is bound to the combo box and all work well. however, I would like to be able to add a new client in the subform but this is, of course bound to the combo box. Can anyone tell me if there is a way to enter a new client in the subform with out receiving an error message? TIA - Ray
25
10220
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
6
5599
by: Bob Quintal | last post by:
Using Access '97. I have a subform, where the .AllowAdditions property is set to false. I have a button labelled 'Add record' that sets this property = true, followed by a DoCmd.gotoRecord acNewRecord. a Save button sets me.dirty = false; me.AllowAdditions = False a Cancel button sets me.undo; me.AllowAdditions = False This works correctly.
4
2013
by: aqua404 | last post by:
I know this has been discussed, but I can't find a resolution. I have a subform on a form. The table with the data for the main form has 15,000 records. I am opening and then setting recordsource so as to only pull 1 record. The table where the subform data comes from has 130,000 records. There is a parent/child link. Indexed on those fields. I have set the datasource to the table, SQL statements and a number of different queries...
5
2776
Scott Price
by: Scott Price | last post by:
Hello, I'm running Access 2003 trying to filter a subform with approximately 15 records per year per the main record contained on the parent form. The filter works fine if the subform is opened independently, and right-clicking on the subform after opening the main form, and choosing filter by selection also works. The problem is getting the filter to apply when the parent form opens. I've checked for spelling errors a dozen times, what I...
2
2165
Scott Price
by: Scott Price | last post by:
Hello again! Running MS Access 2003 on WinXPproSP2. Now I'm trying to re-filter my subform based on the currently shown Year field (the filter applied on open restricts to 15 records relating to the year 1990). I've added a command button to call the code designed to re-filter to the 13 or so records according to the next year (1991 in this case). There may be other ways to do what I'm wanting (i.e. through pivottable views, etc., but...
6
10753
by: solom190 | last post by:
Okay this is the situation I have two forms and they have a 1:M relationship. I don't have enough space screen-wise to do a traditional "drag form to form" to create a subform so what I did was create command buttons that open the subform when I click on it. I added a filter to the VBA that filters the results of the subform to display only records that match the linking field of the two forms. And it those and would filter but..I am having...
0
8315
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
8829
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
8734
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...
0
8608
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
7341
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
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
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.