Solved

How do you connect two tables in a form so that they are in sync when the form is used

Posted on 2012-04-07
8
359 Views
Last Modified: 2012-04-10
I have two tables a Header and Detail table I have the primary key in the header table and the primary key in the detail table.

My question is how do I connect them together so that they show up when a form is entered and records are entered in both the header and the detail section. I am a beginner so I have learned the table building but do not know nor have ever seen how to connect them so they show up in sync on a form page.

I know it has something to do with the background SQL and tying it together. I am clueless how that works. Please advise. Any examples or video is really helpful. Thank you.
0
Comment
Question by:ruavol2
[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
  • 2
  • 2
  • +2
8 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 100 total points
ID: 37819142
For this table structure you typically use a form consisting of a  main form containing a subform.

You create a main form based on the header table.

Then you create another form based on the detail table.  (In due course thiss will be placed o your main form as a subform- as below).

Then you add a subform control to your main form and the wizard guides you through the process, in which you select the form to be used (your detail form) and how the main form and subform link together.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 100 total points
ID: 37819153
0
 
LVL 30

Assisted Solution

by:hnasr
hnasr earned 200 total points
ID: 37820458
Assume the tables:
A (a, r, x) - primary key (a)
a r
1 a1
2 a2

B(a, b, r) - primary key (a,b)
a b r
1 1 b11
1 2 b12
2 1 b21

When you create a form based on table A (bound to table A), you get the default text boxes a and r. Let's call it frmA
The same for a form bound on table B, you get the default text field names a, b,  and r. Let's call it frmB.

Open form frmA in design mode, and drag frmB on it in the detail section, this frmB is now encapsulated in a control (subform control) with the default name frmB. The wizard if it is activated, will ask for the master link fields, and child link fields. Select a for master, and a for child the link is established.

If the form fields are renamed, the link keys has to be changed to the new names.
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.

 

Author Comment

by:ruavol2
ID: 37821823
I do not know if you guys have any knowledge of this but when I use the instructions from above everything looks good right up until I try to enter the sub form. Then I get the following error message and I do not know how to get past it. Can you tell me what is blocking it. I am not seeing it. Please advise. Else I can post a new question if it is not related. Thank you.
AccessError.png
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 37821979
it will help if you can upload the db you are working on.
0
 
LVL 30

Assisted Solution

by:hnasr
hnasr earned 200 total points
ID: 37822249
Find Msaccess.exe
Right click the icon  and select Run as administrator.
Open database. Check and comment.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 37824707
ruavol2,

I am confused by your request.

First, can you please put real names on these very vague "Detail" and "Header" tables...

Customers/Orders?
Employees/Sales?
Orders/Parts?

Typically you already have all the "Parent" records and you are simply entering the "Child" records...
So I am not clear on what you mean by:
"and records are entered in both the header and the detail section."

Here is a very basic sample in addition to the info already posted

In this case the Main/subform setup that the previous experts mentioned seems to be what you need.
0
 

Author Closing Comment

by:ruavol2
ID: 37831204
I got it to work. Thank you for your help.
0

Featured Post

Independent Software Vendors: 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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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…

749 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