Delete from a joined query

Canderel

Registered User.
Local time
Today, 11:29
Joined
Mar 29, 2005
Messages
30
Hi...

I have an Access query, which gives me the "orphans", between two tables.

They look like this
Code:
tblSurveys       tblJobs
*                *
Grade        ->  JobGrade
Paytype      ->  JobPayType
Survey       ->  JobSurvey
other...     ->  other (including jobcode)

Linked as indicated, (all from tblSurvey to those matching tblJobs)
with criteria, WHERE jobcode is null
Ie. an unmatched query between tblSurvey and tblJobs.

Now I want to delete those from the survey where there is no jobs.

But when I change my select query to a delete query, I get the error:
Cannot delete from specified tables

My SQL (access generated) looks like this:
Code:
DELETE tblSurveys.*, tblJobs.JobCode     
FROM tblSurvey LEFT JOIN tblJobs ON 
  (tblSurveys.Grade = tblJobs.JobGrade) AND 
  (tblSurveys.PayType = tblJobs.JobPayType) AND 
  (tblSurveys.Survey = tblJobs.JobSurvey)
WHERE (((tblJobs.JobCode) Is Null));

That first line looks wrong...

Anyway, if someone can help me to delete these I will be forever grateful.

The way I understand it, a delete query should look more simple... ie
delete * from tblName where (and type the intricate stuff here)

Thanks in advance
Reenen

(BTW: I posted this on Ozgrid as well, but they are bigger on Excel there, and response times are better here. Apologies in advance)
 

Users who are viewing this thread

Back
Top Bottom