Connecting Tech Pros Worldwide Forums | Help | Site Map

Delete Query Access2000

Newbie
 
Join Date: Dec 2008
Posts: 1
#1: Dec 2 '08
Help, i'm new to this.
I'm trying to run a delete query in Access 2000 and the error message i get is: 'Could not delete from specified tables'

I want to delete ProductMaster.[PART NO] that does not exist in [FINAL MASTER].[PART NO], what have i done wrong?


The SQL for the query is:
SELECT ProductMaster.*, [FINAL MASTER].[PART NO]
FROM [FINAL MASTER] RIGHT JOIN ProductMaster ON [FINAL MASTER].[PART NO] = ProductMaster.[PART NO]
WHERE ((([FINAL MASTER].[PART NO]) Is Null));

Expert
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,176
#2: Dec 2 '08

re: Delete Query Access2000


Try something like this:
DELETE * FROM ProductMaster WHERE NOT EXISTS (SELECT Part_No FROM FinalMaster WHERE ProductMaster.Part_No = FinalMaster.Part_No)

EXISTS examples:
SQL: EXISTS Condition
Reply