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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
ACCESS 2007
Teresa 

16 years ago
IN ACCESS 2007 - Why is a field with an AutoNumber data type not a good candidate for the foreign key field for a one-to-many relationship?


Answer from Richard Rost:

It's not only a bad candidate, it's IMPOSSIBLE.

An Autonumber gets assigned by Access each time you add a new record to a table. So it's great for a PRIMARY key, like CustomerID in the CustomerT table:

ID, Name
1, Joe
2, Fred
3, Bill
etc.

However, if you have an OrderT table and you want to track which CUSTOMER each order is from, you can't have Access assign IDs automatically. You have SPECIFY which customer belongs to each order (the Foreign key).

The primary key of the ORDER table would be an Autonumber (the OrderID)… but the foreign key has to be a NUMBER of type Long Integer.

OrderT table:
ID, CustomerID, OrderDate, etc.
1, 3, 1/1/10
2, 1, 1/1/11
3, 3, 1/1/11
4, 2, 1/1/12
etc.

Here you can see that Order 1 was made by Customer 3 (Bill) and so on. If Access were assigning those values, it would make your data meaningless.

It sounds to me like you need to learn a little more about the basic concepts of building a Relational Database, and making relationships between two tables.

Watch this free tutorial on my web site for help with this topic:

http://599cd.com/tips/access/relational-tables?key=BlFAlEx

I also spend a whole hour in my Access 201 class going over table relationships:

http://599cd.com/site/access/access201?key=BlFAlEx

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

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/25/2026 2:14:12 AM. PLT: 1s