Solved

How do I filter the data on a subform on a tab control based on the parent form in Access 2007?

Posted on 2014-01-09
8
371 Views
Last Modified: 2014-08-28
I have an Access 2007 database where the parent table/form is for Unit Owner and the child/subform is for Visitors.  The subform (located on a tab control of the parent form) functions properly, however it displays all of the visitors.  In the Visitor table, there is a field for Out Date.  I only want to show the current visitors on the subform.  That would be any visitor record for that unit owner that has a Date Out of today or later OR when the Date Out field is blank.
Using the query as the record source to open the Visitor subform independently works only when I have the Unit form already open to a specific unit.  If I open the Unit form, several popup windows occur (because I'm assuming the query has run and the subform doesn't have any data to display).  Do I need to add code into the form's event properties?  On Open, On Load, After Update, etc?
The subform contains the following fields: Visitor, Category, Date In, and Date Out.  In the sample attached there are two Entry System forms.  I am working on the one that ends in "FD" as well as the subform named VisitorSubform FD.  The tables for UnitOwner and NotesVisitor link via the unit number.  I need both versions of the Entry System forms to work.  One will show all visitors, past and present, the FD version will only show those >Date() or is null.
EntrySystem.accdb
0
Comment
Question by:rdani08
  • 5
  • 3
8 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39769916
you can use the subformControl Master and Child Fields property to filter the subform.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39769929
your table UnitOwner field Unit does not have a value corresponding to field UnitNo in table NotesVisitors..


see this revised db
EntrySystem.accdb
0
 

Author Comment

by:rdani08
ID: 39769935
The Master and Child fields are linked.  Unit to Unit ID. That is not the problem.  Let provide an example:
Unit 1 has Vistors A, B, C, and D.  In the Date Out field: A is Null, B and C are dates prior to Today, D is dated 3 months from now.  I only want to show Visitors A and D for Unit 1 when the form is opened.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39769938
see the file I uploaded
0
 

Author Comment

by:rdani08
ID: 39769948
That file does not work properly either.  What form and subforms did you modify?  What steps are you taking?  This is a sample database and I need to be able to recreate the solution in the actual database.  Thank you
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39769958
are you reading my post?  http:#a39769929
0
 

Author Comment

by:rdani08
ID: 39770021
Yes, I have read your posts.  The file you posted does not work the way I have asked.  There are no relationships created. Maybe I am not explaining the issue properly.  If I create the relationship in Database Tools between Unit and UnitNo, What do I do next to ensure I can still have two versions of the Entry System?  One is Entry System with VisitorSubform. This will show all Visitors (current and past) for the linked Unit. The other, Entry System FD with VisitorSubform FD, will only show Visitors for that Unit with no date entered (null) or a future date entered in Date Out.  I appreciate your responses but I need further explanation/help.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39770026
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My experience with Windows 10 over a one year period and suggestions for smooth operation
Outlook Free & Paid Tools
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question