Solved

Joining forms to Sub forms (Using invisible)

Posted on 2011-03-21
2
161 Views
Last Modified: 2012-05-11
Hi,

Often, when I join a form to a sub form I find I need to put invisible fields on the form to facilitate the join.  I am wondering is this the best way to do things??

EXAMPLE:
A Teacher has many students.

When I am calling a subform to display all the student names  (for one particular teacher) I find that I need to put the "TEACHERID" onto the main form and make this (numeric) field invisible.

I am happy to continue doing this but wonder if there is a less convoluted way.

(My example is not very clear but hopefully you will get the meaning)
0
Comment
Question by:Patrick O'Dea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 500 total points
ID: 35180979
You can do it a variety of ways, but basically there are two methods.

1.  Use the Link Master/Link Child fields properties in the Data tab of the Properties window.  Used when you your main form is bound to a data source

2.  Write the RecordSource of the subform so that it refers to one or more fields in your main form.  You are probably already doing this.

Either way, you are going to have to have one or more fields on your main form which define which records to show in the subform.  How are you selecting the teacher whose students you want to display?  If it is a combo or list box, modify the RowSource for the control to include the TeacherID as the first column in the query, then set the controls Control Count =2, Bound Column = 1, and Column widths to something like 0"; 2".  This will allow you to have the TeacherID in the form.

Then, if you are using option #1, the subform will probably refresh automatically.  If you are using option #2, you will have to use the AfterUpdate or Click event of the combo/list to requery the subform.

0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35181060
Thanks fyed,

Very comprehensive answer.

As I suspected, I am doing things a slightly convoluted way.  I will study you answer in full detail later.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

617 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