My Access Delete query gets the error "Specify the table containing the records you want to delete"

Robert Aubry 61 Reputation points
2021-06-11T17:59:00.087+00:00

I don’t know what is wrong with this Delete Query(Reconcilement Query6(TEST)). I want to delete the records in tblTemporaryTranactions that narrowed down to the records left in Reconcilement Query5

The SQl View is:

DELETE tblTemporaryTransactions.ID, tblTemporaryTransactions.Account, tblTemporaryTransactions.Debit, tblTemporaryTransactions.Credit, tblTemporaryTransactions.Balance
FROM tblTemporaryTransactions INNER JOIN [Reconcilement Query5] ON tblTemporaryTransactions.ID = [Reconcilement Query5].ID;

Any help would be appreciated. Bob

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
821 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ken Sheridan 2,666 Reputation points
    2021-06-11T19:01:56.92+00:00

    Try:

    DELETE *
    FROM tblTemporaryTransactions
    WHERE EXISTS
    (SELECT *
    FROM [Reconcilement Query5]
    WHERE [Reconcilement Query5].ID = tblTemporaryTransactions.ID);

    Note: there should be a space and asterisk after DELETE and SELECT in the above statement. The formatting here seems to remove them.


3 additional answers

Sort by: Most helpful
  1. DBG 2,301 Reputation points
    2021-06-12T16:02:17.693+00:00

    Hi Bob,

    Just curious, would this work as well?

    DELETE DISTINCTROW FROM tblTemporaryTransactions
    INNER JOIN [Reconcilement Query5]
    ON tblTemporaryTransactions.ID=[Reconcilement Query5].ID
    

    Could you please test and let us know? Thanks!

    0 comments No comments

  2. Robert Aubry 61 Reputation points
    2021-06-13T13:34:00.163+00:00

    Sorry thedbguy but it produces the error "Syntax error in DELETE statement". Bob


  3. Ken Sheridan 2,666 Reputation points
    2021-06-13T20:28:26.573+00:00

    Did my original SQL statement, with the addition of the missing asterisks, work? The line numbers must be omitted of course:

    DELETE *
    FROM tblTemporaryTransactions
    WHERE EXISTS
        (SELECT *
         FROM [Reconcilement Query5]
         WHERE [Reconcilement Query5].ID = tblTemporaryTransactions.ID);