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: Four Employees Per Event
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   7 years ago

textHey folks. As you probably imagine, I get a TON of questions every day from people asking how to do things in Access. I'm going to try to start picking one question every day and posting my answer here. Today's question comes from one of my students, David. He asks:

I'm using Access 2010. I have an Employee Table with Employees and an Event Table where I need 4 employees for every event. So I have 4 fields in the event table called "Staff1", "Staff2", "Staff3", "Staff4" and they are set to be a number of type long integer so that they are essentially all foreign keys to the primary key "EmployeeID" autonumber in the EmployeeT.

Now I'd like to make a query that shows me each event per row. I've added the 4 "Staff" fields from the EventT but naturally they are just numbers. How do I see the names associated with those numbers from the EmployeeT? Normally I would just add the Employee Name field from the EmployeeT and make sure the primary key and foreign key are related. However since all four of those foreign keys are related to the same primary key, the query is turning up empty when I run it.

The end goal is to create a report that shows each event and shows the 4 Staff names of the four employees assigned to the event. Thanks!


Hi David.

Whenever you have more than ONE of something, you really should move that SOMETHING to a separate table. Here, for example, you should have an EventT table, an EmployeesT table, and then an EventXEmployeesT cross-reference table where you can track which employees are in which event. This is a classic MANY TO MANY relationship. Each event can have multiple employees, and each employee can belong to more than one event.

I would make an event form based on the EventT table, and then have a subform based on the EventXEmployeeT table. In that subform, you would have combo boxes that are based on the EmployeeT table to select the employees for the event. You could also go backwards and show a subform on each employee's record for which events they're in. I cover this in Access Expert 7.

Once you've got this set up properly, it would be easy to create a report where you could design a GROUPING LEVEL level for the event, and then in the details show all of the employees. Again, covered in Access Expert 7. Review that lesson, and then if you still have questions, let me know.

Richard

Access Four Employees Per Event Upload Images   Link 
Richard Wilson 
7 years ago
So if ones "Events" are delineated by years, you would recommend having a YearsT?


Reply from Alex Hedley:

If you have multiple events that can occur on multiple years yes.
Add a Reply
Four Employees Per Event Upload Images   Link 
David M 
7 years ago
Thanks Rick!! This was exactly what I needed! There's so much to learn and remember in Access it was very helpful to be pointed to the right place and remember that I knew how to do it already!

Thanks again!
Add a Reply
Access Four Employees Per Event Upload Images   Link 
Alex Hedley 
7 years ago
I'd agree with Rich and use the Junction Table.

If you can't you could add the EmployeeT 4 times in your Query so each 1 joins to 1 of the Foreign Keys then pull in the EmployeeName from each and now they will all show
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:

7/24/2021Missing Months
7/24/2021Center Vertically
7/23/2021DCount
7/22/2021Buy Access
7/21/202164-Bit Access
7/20/2021Relationships
7/18/2021Splash Screen
7/11/2021Access Developer 30
7/11/2021Access Developer 31
7/11/2021Access Developer 31 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: many to many group by  PermaLink