Delete Query v Could not Delete from Specified tables

G

Guest

I'm trying to delete entries in one table using the results of an earlier
query (QUERYONE) which lists unmatched entries in a comparison with another
table. I've seen various postings which have similar queries, but either
these have not helped me or I do not fully understand how/where to
create/insert the SQL statements that have been referred to (I'm a bit of a
novice in this area!). I'm trying to set the delete query up via the Design
View, showing the Table and the earlier Query and then select Delete Query
type.
e.g. In Column one, Field has TABLENAME *; Table has TABLENAME; Delete has
From in it.
The table (TABLENAME) and the query (QUERYONE) have the relevant field linked.

Can anyone help me please?
 
M

[MVP] S.Clark

An Example SQL statement is:

DELETE Products.*
FROM Suppliers
RIGHT JOIN Products ON Suppliers.SupplierID = Products.SupplierID
WHERE (((Suppliers.SupplierID) Is Null));

Even when setup correctly, you could end up with an error about a unique
index or primary key.

With the UI:
-add both tables,
-draw a link if one is created automatically.
-Right Click on Link, choose Join Properties
-Select the radio button which states to show ALL information from the table
OF WHICH THE RECORDS ARE TO BE DELETED. (Stressing, not shouting)
-Add the Is Null criteria against the other table's linking field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top