Solved

Joining forms to Sub forms (Using invisible)

Posted on 2011-03-21
2
160 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 (Access MVP) 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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 …

752 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