Access 2007-2016
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

News      User Comments     History     Notify Me

5/7/2008 1:22:36 AM
Access: Many-To-Many Relationships
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

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).

1, Joe
2, Bill
3, Sally

1, Electrical
2, Plumbing
3, Painting

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

Permanent Link
Keywords: access many-to-many relationships junction cross-reference tips
Post Reply

Add Your Comments or Subscribe
If you just want to subscribe to get email updates when the News is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 1+2:
  Notify me when the News is updated.
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



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

2/22/2018Microsoft Access Developer 6
2/22/2018Access Assistance Available
2/21/2018Putting Access Databases Online
2/18/2018Microsoft Access Developer 5
2/10/2018Microsoft Access Developer 4
2/1/2018Access Tip: Salary History
7/19/2017Access Developer 2 and 3 Released
7/19/2017Microsoft Access Developer 3
7/19/2017Microsoft Access Developer 2
6/30/2017Access Developer 2 is Finished

Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP