Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Index   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Subforms < Turn Off Filter | Help Desk >
Back to Subforms    Comments List
Upload Images   Link   Email  
Subform Linking
John Draper 
     
19 months ago
My Subforms are not taking data from the parent form and I cannot figure out why.  The table has matched ID's (and I verified spelling).  The master/child links in properties match.  However, when I enter new data into the subfield and then look at the table it doesn't take the ID's from the parent form to relate the data.

Any Ideas?
Scott Axton 
         
19 months ago
Do you have the ParentForm primary key as a ForeignKey stored in the ChildForm ?

If you leave the record and come back does the Child information appear?
John Draper OP 
     
19 months ago
Yes, in this case The parent is MaintenanceID and the child is MaintenanceDetailID.  I have MaintenanceDetail as the the primary key in the Child Table and MaintenanceID as a foreign key.  When filling in information in the maintenanceID continuous subform, the MaintenanceID does not populate in the MaintenanceDetailT.  I cannot figure out what is wrong.
John Draper OP 
     
19 months ago
Two more things, no, it doesn't fill in after I close the window, and it seems that I am having this issue with all of my subform relations.  Seems like there is something fundamental I haven't done.  I have watched many videos on this and I think I have done everything I am supposed to do. I made the tables relational using Primary Key/ Foreign Key, I made the forms from the tables.  I opened up the parent form and dragged the subform onto it.  I verified the link master and and link child fields are the same.  Is there something I am not doing?
Scott Axton 
         
19 months ago
If Access can't determine the linking fields, which can happen if the fields are named differently as you have, then you have to manually link the fields in the subform properties.

In the form where you added the subform, click on the subform once.  The then look at the properties either under the Data tab or the All tab for the Link Master Field (That should be MaintenanceID) and the Link Child Fields (That should be MaintenanceDetailID).  If those are not filled in you will have to manually set them using the ... button.
  
If you want to name you fields like you have, you will have to get used to manually making the connection.
Personally I ALWAYS name the foreign key the same as the Primary Key in the parent table.  The only difference is that the foreign key is not an autonumber.  Just a number of type Long Integer.
Kevin Yip 
     
19 months ago
As Scott suggested, click the "..." button to set the master and child fields (see picture below).  Sometimes the pop up will automatically make the right suggestion for you.
Kevin Yip 
     
19 months ago

Kevin Yip 
     
19 months ago
As long as your tables have the right data, the method above will work.  Parent and child tables should have data the look like below.  The parent table has one primary key field that is used to link it to the child table.  The child table usually has a two-field primary key as shown below:

Parent table:
ID (PK)   Field1
1         John
2         Jane
3         Joe
4         Juan

Child table:

ID (PK)   LineNum (PK)   Field1
1         1              John's first item
1         2              John's second item
1         3              John's third item
2         1              Jane's first item
2         2              Jane's second item
4         1              Juan's first item
4         2              Juan's second item
4         3              Juan's third item
4         4              Juan's fourth item

In table design, both the ID and LineNum fields should a "key" symbol next to them, indicating a two-column primary key.  That means the ID-LineNum combination should be unique.  Every table should have a primary key.  And this is how a child table's primary key should be.
John Draper OP 
     
19 months ago
Thanks for all the help!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Subforms.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 12/5/2024 6:07:00 AM. PLT: 1s