Solved

Explanation of Master/Subform and PK/FK Link fields

Posted on 2004-09-02
6
1,110 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

738 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