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
366 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
ID: 39769916
you can use the subformControl Master and Child Fields property to filter the subform.
0
 
LVL 119

Expert Comment

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

Expert Comment

by:Rey Obrero
ID: 39769938
see the file I uploaded
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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 119

Expert Comment

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

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39770026
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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…

910 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

25 Experts available now in Live!

Get 1:1 Help Now