Solved

Explanation of Master/Subform and PK/FK Link fields

Posted on 2004-09-02
6
1,111 Views
Last Modified: 2008-07-14
I need an explanation of how Master/Subform works and how to link the forms.
I have 2 tables. They are related by orderid.  Orderid is 1 to many from Main to Multiplelinetable.
Main = orderid  
Multipleline = orderid.
When I create a Main form and add Multiple Line as a subform, when I add a new record to Main, and then a new record to multipleline, the orderid is not being put into the multipleline table. Hence, they are not linked.
I read about PK/FK and Master and Child fields, and it seems that the child field should be automatically populated but I have no idea what I am doing wrong. Please explain how it works.
0
Comment
Question by:jykler
[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
6 Comments
 
LVL 2

Expert Comment

by:wblakely
ID: 11964769
On the properties for the "Multiple Line" subform, did you fill in "Link Child Fields" and "Link Master Fields" with "orderid"?
0
 

Author Comment

by:jykler
ID: 11964858
Oh yes, of course :)
It doesn't seem to be linking though. DO I put the name of the table field, the name of the field on the page? What place do I put it to make it put the correct field in the table?
How should the underlying query look? Should it include both tables? Should that be set to the master form? or the child form? I don't understand the concepts.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 11964884
i think this will give you a good overview of the main/subform

Create a form and a subform at the same time

In the Database window, click Forms  under Objects.
Click the New button on the Database window toolbar.
In the New Form dialog box, double-click Form Wizard.
In the first wizard dialog box, select a table or query from the list. For example, to create a Categories form that displays products for each category in a subform, select the Categories table (the "one" side of the one-to-many relationship).
Note   It doesn't matter which table or query you choose first.

Double-click the fields you want to include from this table or query.
In the same wizard dialog box, select another table or query from the list. Using the same example, select the Products table (the "many" side of the one-to-many relationship).
Double-click the fields you want to include from this table or query.
When you click Next, if you set up the relationships correctly before starting the wizard, the wizard asks which table or query you want to view by. Using the same example, to create the Categories form, click By Categories.
In the same wizard dialog box, select the Form With subform(s) option.
Follow the directions in the remaining wizard dialog boxes. When you click Finish, Microsoft Access creates two forms, one for the main form and subform control, and one for the subform.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 4

Assisted Solution

by:naivad
naivad earned 250 total points
ID: 11964915
Here is a trick I use:

Choose a form that you want for a parent form. Open it in design view. Switch to Database Window. Drag the form you want to be used as a child form onto the design view of the parent form. Drop. It should automatically select the relationships needed if there are similar field names used in pk/fk relationships.

I find this easier than using the subform control on the toolbox.

After the relationship is defined, then you should be able to look at the property settings to see what access did.

Hope this helps.

0
 

Author Comment

by:jykler
ID: 11966732
Thanks for the options. We will try them out, I will be out of the office until Tues Sept 7. When I get back I will try and let you know how things went and put the pts in.
0
 

Author Comment

by:jykler
ID: 12011941
Thanks! We got the program working.. Appreciate all the help you guys give..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

696 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