2 days ago: Power and Internet are out in my office due to Hurricane Ian. Click for details.
 
Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Seminars   Templates   TechHelp   Fast Tips   Forums   Help   Contact   Join   Order   Logon  
 
Access: Four Employees Per Event
By Richard Rost   Richard Rost on Twitter Richard Rost on LinkedIn Email Richard Rost   8 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

Comments for Access: Four Employees Per Event
 
Age Subject From
8 yearsAccess Four Employees Per EventRichard Wilson
8 yearsFour Employees Per EventDavid M
8 yearsAccess Four Employees Per EventAlex Hedley

 

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
 

Check out these other pages that may be of interest to you:

9/27/2022Report Border
9/26/2022First Day of Month
9/23/2022Before Update
9/22/2022Synchronize Subforms
9/21/2022InputBox
9/20/2022Link Master Fields
9/19/2022DateSerial
9/18/2022Sequential Annual Coding
9/16/2022Scope
9/15/2022Resize Forms
 
 

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
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  Access: Four Employees Per Event