Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   Courses   Seminars   Templates   Help   TechHelp   Forums   Contact   Join   Order   Logon  
 
 
Access: Many-To-Many Relationships
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   13 years ago

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 Upload Images   Link  
Mustafa Hatim 
7 years ago
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...
Add a Reply

Start a NEW Conversation
 
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:

12/3/2021Access Beginner 2
12/3/2021Access Beginner 2 Lessons
12/3/2021Access Beginner 2
11/30/2021Import Multiline Cells
11/30/2021Adam's Access Games
11/29/2021Prevent Close
11/28/2021Random
11/22/2021Currency Symbols
11/13/2021Access Developer 36
11/13/2021Access Developer 36 Lessons
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
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
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
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Blog RSS Feed    Twitter

YouTube Channel    LinkedIn
Keywords: access many-to-many relationships junction cross-reference tips  PermaLink