robinsj2564
Technical User
Hi,
Any help would be greatly appreciated. I am trying unsuccessfully to run a Delete Query and keep getting the fairly common response “Could not delete from specified tables.” I have reviewed many similar posts and still cannot seem to get mine to work.
I have 2 tables named “Clients” (larger table) and “DropOuts” (smaller table). Some (but not all) clients in “Dropouts” table are also in the “Clients” table. I want to delete all client records from the “Clients” table that are also found in the smaller “DropOuts” table. There is a one-to-one relationship between these tables.
In most of my attempted delete queries, I have included the “Clients” table and a query of the ‘DropOuts’ data (called ‘Q_DropOuts’). I used a query for DropOuts because the DropOut data came from a different data system and the linking field [CID#_Link] needed to be modified in order to match with the CID# from “Clients” table.
Several Attempts so far result in the right records in a Select Query view but results in “Could not delete….” message when I run it as a Delete Query.
I have tried several variations on the 2 approaches below:
DELETE DISTINCTROW Clients.*, Clients.[CID#]
FROM Clients RIGHT JOIN [Q_DropOuts] ON Clients.[CID#] = [Q_DropOuts].[CID#_Link]
WHERE (((Clients.[CID#]) Is Not Null));
[ALSO]
DELETE DISTINCTROW Clients.*
FROM [Q_DropOuts] INNER JOIN Clients ON [Q_DropOuts].[CID#_Link] = Clients.[CID#];
Also, I hope to do a variation on this for a similar database, but where the “Client Interviews” table will contain one or more client records (i.e., where each record is really a client interview). Any client in the “DropOuts” table (or query) will have one or more records deleted from the “Client Interviews” table (where each client may be administered one or more interviews).
Thanks very much for any help!
Joyce Robinson
Research Scientist, NYS-OASAS
Any help would be greatly appreciated. I am trying unsuccessfully to run a Delete Query and keep getting the fairly common response “Could not delete from specified tables.” I have reviewed many similar posts and still cannot seem to get mine to work.
I have 2 tables named “Clients” (larger table) and “DropOuts” (smaller table). Some (but not all) clients in “Dropouts” table are also in the “Clients” table. I want to delete all client records from the “Clients” table that are also found in the smaller “DropOuts” table. There is a one-to-one relationship between these tables.
In most of my attempted delete queries, I have included the “Clients” table and a query of the ‘DropOuts’ data (called ‘Q_DropOuts’). I used a query for DropOuts because the DropOut data came from a different data system and the linking field [CID#_Link] needed to be modified in order to match with the CID# from “Clients” table.
Several Attempts so far result in the right records in a Select Query view but results in “Could not delete….” message when I run it as a Delete Query.
I have tried several variations on the 2 approaches below:
DELETE DISTINCTROW Clients.*, Clients.[CID#]
FROM Clients RIGHT JOIN [Q_DropOuts] ON Clients.[CID#] = [Q_DropOuts].[CID#_Link]
WHERE (((Clients.[CID#]) Is Not Null));
[ALSO]
DELETE DISTINCTROW Clients.*
FROM [Q_DropOuts] INNER JOIN Clients ON [Q_DropOuts].[CID#_Link] = Clients.[CID#];
Also, I hope to do a variation on this for a similar database, but where the “Client Interviews” table will contain one or more client records (i.e., where each record is really a client interview). Any client in the “DropOuts” table (or query) will have one or more records deleted from the “Client Interviews” table (where each client may be administered one or more interviews).
Thanks very much for any help!
Joyce Robinson
Research Scientist, NYS-OASAS