Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Expert 2    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Primary and Foreign Keys
Kent Jamison 
    
4 years ago
Richard, et al,
Pls forgive the nuisance question here and my confusion.  I had a question after my last lesson (Expert 9).  I was asking about linking primary and foreign keys. To lighten his burden, I'm posting my question here.

I understand 1) Primary Key must be an Autonumber. 2) Foreign Key must also be a number (long integer) usually with the same name to form a relationship.  For example, as Richard says, "If you're doing customers and orders, the CustomerID is the primary key in the customer table."  
NO ISSUES THERE.  I get that part.  It's potentially the second half of the equation where I have questions, if applicable.  Here's where I'm unsure.  (I even went back and listened to Expert 2.2. again, where he introduced explicit/global relationships (of the one-to-many variety), to try to clarify things in my own head.)  
My question: Must you ALSO enter the OrderID in CustomerT (i.e., the opposite direction, as a foreign key)? In other words, do BOTH TABLES require foreign keys AND primary keys from each corresponding table?  If so, this would mean CustomerT would have BOTH CustomerID (primary key) and OrderID (foreign key), while OrderT would have OrderID (primary key) and CustomerID (foreign key).  
Based on my review of your simple tables in Expert 2.2 today, it appears not.  
Please confirm.
v/r
Kevin Robertson  @Reply  
           
4 years ago
You have basically answered your own question. You do not need the OrderID in the Customer Table.
Richard Rost  @Reply  
          
4 years ago
At this stage in your Access learning, just think of it this way... both tables get their own Primary Key. The MANY side of a one-to-many relationship gets the other table's Primary Key as its Foreign Key. One customer - Many orders.
Kent Jamison OP  @Reply  
    
4 years ago
Richard,
Thank you for the clarification.  That is very helpful.

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

Next Unseen

 
New Feature: Comment Live View
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/13/2026 4:09:54 AM. PLT: 1s