Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Explanation of Master/Subform and PK/FK Link fields

Posted on 2004-09-02
6
Medium Priority
?
1,117 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
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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

782 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