Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   News   Courses   Tips   Templates   Forums   Help   Order   Contact   Logon  
 
NEW: Excel Expert 11 - Learn XLOOKUP    dismiss
 
Access: Many-To-Many Relationships
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   5/7/2008 1:22:36 AM

I received an email from a student today asking how to track employees and the hours they bill to each customer. Their programmers work on projects for customers, and they need to bill them accordingly.

You would need an Employees table and a Customers table, obviously. Now you'd need a BillableHours table so you can keep track of the hours each Employee spent working for each Customer. It would look like this:

  • BillableHoursID - AutoNumber
  • CustomerID - Number (Foreign Key)
  • EmployeeID - Number (Foreign Key)
  • HoursWorked - Number (Decimal, how many hours worked)
  • DateTimeWorked - Date/Time (To track what day the work was done)
  • Description - Text (a brief description)
  • Notes - Memo (for whatever)
  • HasBeenBilled - Yes/No (to track if these hours have been billed yet)

Now you have a third table that is related to both of the other tables. You can now generate reports for each EMPLOYEE (how many hours has Joe billed this month?) or by CUSTOMER (what do we need to bill XYZ Corp?)

You've created a many-to-many relationship between Customers and Employees using a JUNCTION or CROSS REFERENCE table. I cover this concept in detail in my ACCESS 2013 EXPERT 7 class and also my ACCESS RELATIONSHIP SEMINAR. There's also a free tutorial on it in my TIPS section: Access Many-To-Many Relationships.

The same situation arises if you have something like CUSTOMERS and what SERVICES they have received. You would have one table with your customers, another table containing a list of services, and then a third JUNCTION table that links them (and even might have details on that particular instance of service).

Customers:

  • 1, Joe
  • 2, Bill
  • 3, Sally

Services:

  • 1, Electrical
  • 2, Plumbing
  • 3, Painting

Junction:

  • 1, 2, 1, 1/1/08
  • 2, 1, 3, 1/2/08
  • 3, 1, 1, 1/5/08
  • 4, 3, 2, 1/8/08

This junction table says:

  • Record 1, Bill had Electrical work done on 1/1/08
  • Record 2, Joe had Painting done on 1/2/08
  • Record 3, Joe had Electrical work done on 1/5/08
  • Record 4, Sally had Plumbing done on 1/8/08

 

Access Many To Many Relationships Link 
Mustafa Hatim - 7/24/2014
Thank you for showing me about many to many relationships.I am trying to create an inventory database in access and your videos are very helpful


Reply from Richard Rost:

You're welcome. Read More...
Loading...
Add Your Comments

 

Post Your Comments
 
Only students may post right now. Click here for more information on how you can set up an account. If you are a student, please LOG ON first.
 
Subscribe
 

You may want to read these articles from the 599CD News:

5/30/2020Two New Access Handbooks
5/30/2020Access Tip Sleep Timer
5/18/2020Access Record Source Property
5/3/2020Access Replace Function
5/1/2020Microsoft Access Tutorials
4/24/2020Access Discontinued?
4/21/2020Date Time Clock Picker Template
4/20/2020Access Backup Record Before Edited
4/17/2020ZIP Code Lookup Template
4/16/2020Access Round Nearest 10
 

Learn
 
Accessindex
Excelindex
Wordindex
Windowsindex
PowerPointindex
Photoshopindex
Visual Basicindex
ASPindex
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search The Site
Waiting List
Production Schedule
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Gift CDs
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed   
Keywords: access many-to-many relationships junction cross-reference tips  PermaLink