Delete Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello i have a delete query that has the following SQL command:

DELETE DADOSVALIDACAO.*
FROM BTSsValidadas_Hist INNER JOIN DADOSVALIDACAO ON BTSsValidadas_Hist.ID =
DADOSVALIDACAO.ID;

When i run this query i have a message saying : "Could not delete from
specified tables"

Why does this happen?
 
Sometimes when you have a query with a join between two tables it wont let
you edit or delete records.
try and change the UniqueRecords property of the query to true, and then try
and run the query.
If it still wont run then create the delete query with one table
 
Try
DELETE DISTINCTROW DADOSVALIDACAO.*
FROM BTSsValidadas_Hist
INNER JOIN DADOSVALIDACAO ON BTSsValidadas_Hist.ID =
DADOSVALIDACAO.ID;


If that fails try

DELETE DISTINCTROW DADOSVALIDACAO.*
FROM DADOSVALIDACAO
WHERE DADOSVALIDACAO.ID IN
(SELECT BTSsValidadas_Hist.ID
FROM BTSsValidadas_Hist)

The reason it fails is that Access is unable to specifically identify which rows
to delete - perhaps you don't have a primary key in the table, or haven't
included it in the query, or perhaps there is another reason.
 
Back
Top