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
364 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 119

Expert Comment

by:Rey Obrero
Comment Utility
you can use the subformControl Master and Child Fields property to filter the subform.
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
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
Comment Utility
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
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
see the file I uploaded
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:rdani08
Comment Utility
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 119

Expert Comment

by:Rey Obrero
Comment Utility
are you reading my post?  http:#a39769929
0
 

Author Comment

by:rdani08
Comment Utility
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 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now