Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by Form and Subform Results

Status
Not open for further replies.

sher2win

Technical User
Jan 7, 2003
4
0
0
US
I have a main form bound to a "Contacts" table and a subform bound to a "Contact_Uses" table. Parent field "Contact_ID" linked to child field "Contact_ID". I have a one to many relationship from tblContact to tblContact_Uses.

Is it possible to use the "Filter by Form" function on the subform to return records on the main form? (show me all the contacts i have for abc and 123 uses.) My filter returns all the main form records and those records in the subform which match my criteria.

Any thoughts would be appreciated.

First time post

sher2win
 
I have been trying to do the same thing, and cannot seem to find any answer to this question. Does that mean it cannot be done? I have seen some posts saying create buttons with querys and whatever, but can it not be done with the 'Filter by Form' button?
 
Hi,

I can't see how the parent form can filter on a property that it presumably doesn't (prehaps shouldn't) have. The only attribute/s that should be on both the parent and child forms are those that link the two together; on that basis you would be able to filter the parent directly.

To achieve the results that you are after, I think you would set the parent form's filter properties through a small bit of code on the child form. I have never tried it, but think it would be fairly simple, like:

Me.Parent.Filter = "YourParentField ='YourValue'"
Me.Parent.FilterOn = True

Note the filter string can include In & Like statements, and that in your case I think you would build a string of values to filter by, or a value based on the current record of the child.


Cheers

steve
 
Thanks Steve

I see what you are saying and it may get me close to what I am looking for, but what if I need to filter based on both main form and subform. Example, my main form contains computer inventory including site location and the subform contains a list of software installed on computers. How would I filter to find all computers at a specific site (main form) that have a certain software installed (sub form)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top