Re: Query not updatable - advise on how to change it
- From: John Spencer <spencer@xxxxxxxxx>
- Date: Fri, 31 Jul 2009 09:25:28 -0400
SELECT tblCoursesTaken.ID, Max(tblCoursesTaken.CompletionDate) AS
MaxOfCompletionDate
FROM tblEmployees INNER JOIN tblCoursesTaken ON tblEmployees.ID =
tblCoursesTaken.ID
WHERE (((DateAdd("yyyy",1,[completiondate])-Date())<0) AND
((tblCoursesTaken.CourseNumber)=30000) AND ((tblEmployees.SafetyActive)=True))
GROUP BY tblCoursesTaken.ID;
The second query links the first query to the employee table where I can
change the Safety Flag to False:
UPDATE qrySafetyExpired INNER JOIN tblEmployees ON qrySafetyExpired.IP_ID =
tblEmployees.IP_ID SET tblEmployees.SafetyActive = False;
but it doesn't work because the query is not updatable.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Angela wrote:
I know that there are many posts regarding non-updatable queries and I've read thru most of them but still don't quite understand what I need to do to get this query to be updatable, or perhaps it's just not possible. Sorry if this is a newbie question..
I have two tables, one contains employee data and the second contains a list of courses that they have taken which includes dates. There is one safety class that must be taken every year. From the table containing courses taken joined to the employee table, I used a group query to find the last date on which each employee took the mandatory course for those employees that currently have SafetyActive=True. If the completion date was over a year ago, I want to go into the employee table and change the "SafetyActive" flag to False.
My first query to find the list of employees with expired courses is a group query:
SELECT tblCoursesTaken.ID, Max(tblCoursesTaken.CompletionDate) AS MaxOfCompletionDate
FROM tblEmployees INNER JOIN tblCoursesTaken ON tblEmployees.ID = tblCoursesTaken.ID
WHERE (((DateAdd("yyyy",1,[completiondate])-Date())<0) AND ((tblCoursesTaken.CourseNumber)=30000) AND ((tblEmployees.SafetyActive)=True))
GROUP BY tblCoursesTaken.ID;
The second query links the first query to the employee table where I can change the Safety Flag to False:
UPDATE qrySafetyExpired INNER JOIN tblEmployees ON qrySafetyExpired.IP_ID = tblEmployees.IP_ID SET tblEmployees.SafetyActive = False;
but it doesn't work because the query is not updatable.
I understand from previous posts that the first query makes this non-updatable because of the grouping. Is there another way to accomplish this task, or another way to design these queries so it will work?
- References:
- Query not updatable - advise on how to change it
- From: Angela
- Query not updatable - advise on how to change it
- Prev by Date: RE: Query-Report
- Next by Date: RE: Query not updatable - advise on how to change it
- Previous by thread: Query not updatable - advise on how to change it
- Next by thread: RE: Query not updatable - advise on how to change it
- Index(es):
Relevant Pages
|