Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Explanation of Master/Subform and PK/FK Link fields

Posted on 2004-09-02
6
Medium Priority
?
1,114 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 1000 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 4

Assisted Solution

by:naivad
naivad earned 1000 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

688 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