[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MS Access and self reference table

Posted on 2016-11-02
4
Medium Priority
?
155 Views
Last Modified: 2016-11-03
I have a table of employees.  There is a employee supervisor column which points to the employee record of the supervisor.  So, the table references itself.  The table has a dept column.   if the dept of the supervisor changes, I want to change the dept for all employees that have that supervisor.   I would know how to do this using SQL server, but I can't get it to work using MS Access.
0
Comment
Question by:HLRosenberger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1000 total points
ID: 41871031
try this query

UPDATE tblEmployees INNER JOIN tblEmployees AS tblEmployees_1 ON tblEmployees.Supervisor = tblEmployees_1.EmployeeID SET tblEmployees.Dept = [tblEmployees_1].[Dept]
WHERE (((tblEmployees_1.EmployeeID)=5));

you have to place the EmployeeID of the supervisor in the criteria
0
 
LVL 31

Assisted Solution

by:hnasr
hnasr earned 1000 total points
ID: 41871187
In general:

UPDATE Employee As e INNER JOIN Employee As s ON e.SupervisorID = s.EmployeeID
SET e.Dept = s.Dept
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 41871194
;-)
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41872024
Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question