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

Best Way to Sync Parent Form With SubForm Filtered Records

43
What would be the best way apply a filter to a subform and then apply that recordset to the parent form?

For example.
Parent Form - Groups: ID, GroupName
Subform - Members: MemID, GrpID, Name, Age

Forms linked with Groups.ID = Members.GrpID

Parent Form has Button - btn80 - "80 Year Olds"

Expand|Select|Wrap|Line Numbers
  1. Private Sub btn80()
  2. ' Create filtered recordset in subform
  3. Me.subfrmMembers.Form.Filter = "Members.Age = 80"
  4. Me.subfrmMembers.Form.FilterOn = True
  5.  
  6.  
'How could the corresponding recordset be created in the Parent Form?

'Any Way to Progressively Filter Out Records In Form's Recordset?

'Possibly:

Until Me.subfrmMembers.Form.RecordsetClone.EOF
... ' Somehow add to Me.Filter with an operation on the filtered recordset each time? I noticed if you just set the filter each time it drops the previous filter


Is there a way within the form to redefine related recordsets based on a filter?

I think I have done this before by setting up a query as the data source for the form with criteria in the query pointing to the value of a control on the form, but I was wondering if I could get around that and do it all in the form.
Sep 17 '11 #1

✓ answered by RuralGuy

Maybe this is the link you seek: http://allenbrowne.com/ser-28.html

5 3081
RuralGuy
375 Expert 256MB
Maybe this is the link you seek: http://allenbrowne.com/ser-28.html
Sep 17 '11 #2
nico5038
3,080 Expert 2GB
I see you found the form linked fields, but are puzzled by the requirement:
'How could the corresponding recordset be created in the Parent Form?'
and the "80-years" button puzzles me too.

In general I would use the linkage fields for linking the main form to the subform and instruct the user to use the right-click pop-up form. When right-clicking the Age field the user can type "80" in the filter field (but also "70") and Enter.
All other right-clicks will automatically be added wit the "AND" relation.

Now inspecting the Me.Filter will show the "WHERE" you can pass to e.g. a report to print just the selection.

Getting the idea ?

Nic;o)
Sep 18 '11 #3
Sedrick
43
RuralGuy, that's the one I was looking for. Thanks! I thought I had seen this before but couldn't place where to find it.

I ended up doing it with a query as the static RecordSource and having the criteria in the query check the value of a Control on the Form. Changing the RecordSource dynamically is better though.
Sep 19 '11 #4
RuralGuy
375 Expert 256MB
Excellent! Glad we could help.
Sep 19 '11 #5
Sedrick
43
nico5038,

You know, what you shared about right clicking on text fields in the form is something I may have known about before but have not used very much at all with Access forms. I use it alot in Windows Explorer, Excel and a few other apps but not that much in Access.

I can see now that there are many instances in dealing with form input that it could save me overall, a tremendous amount of time! In filtering and sorting I have usually gone to the menus at the top of the screen, but right clicking is much quicker and I think it is something that I will be using a lot more.

Thank you for suggesting this!
Sep 20 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

25
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...
2
by: origin197511 | last post by:
Hello all... I'm having an issue with MSAccess 2000. I have a Form that holds records of my cartridge loads for a rifle and a subform that lists all groups that have been fired with that load. ...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
2
by: c.kurutz | last post by:
Hello everyone. I have a problem with looking up pricing. Here is what I have so far: TABLES tblItems: itemid itemdescription itemunit (each, roll, square foot) location1price
13
by: bitsnbytes64 | last post by:
Hi, I have a form which contains a subform. Both are were creetd using the form wizard and are bound by the column IXO_NR (on two different tables), which is the control source for a textbox on...
7
by: dscarbor | last post by:
I have a simple form with 4 fields, and a subform that retrieves records that are potential matches based on a query. The user will use the ID from the subform record and enter it into one of the...
1
by: ckrows | last post by:
Hi guys, I have a parent form that displays the subform. The subform query has a link back to the original ID. I was having issues keepign them in sync, since every parent may not need a...
6
by: Nettle | last post by:
Purpose: I am creating a mailing distribution list database. Users should be able to filter/search contacts and add them to distribution lists they have created. My problem? I can't add multiple,...
1
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
3
Jerry Maiapu
by: Jerry Maiapu | last post by:
Can please someone help me out. I am a beginner (of VB) I have a main form with a sub form created based on two tables having one to many relationships. i want to prompt the users a message...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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...
0
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,...
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...

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.