Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012

    Unanswered: DELETE SQL Error

    I have the following Code:

    Dim DelOld As DAO.QueryDef

    Set DelOld = CurrentDb.CreateQueryDef("", "DELETE * FROM CompetitiveFoodsTable CFT " & _
    "LEFT JOIN CompetitiveFoodsWorkingTable CFWT ON CFT.[Fox Item Num] = CFWT.[Fox Item Num] " & _
    "WHERE ((CompetitiveFoodsWorkingTable.[Fox Item Num]) Is Null)")

    And everytime I run it I am getting this error:
    “specify the table containing records you want to delete”

    I thought I would be able to get around this error using SQL, but I must have been mistaken or my SQL is written wrong any ideas?

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    I would try:
    DELETE FROM CompetitiveFoodsTable
    WHERE [Fox Item Num] IN (SELECT CompetitiveFoodsTable.[Fox Item Num] 
                               FROM CompetitiveFoodsTable LEFT JOIN 
                                 ON CompetitiveFoodsTable.[Fox Item Num] = CompetitiveFoodsWorkingTable.[Fox Item Num] 
                              WHERE CompetitiveFoodsWorkingTable.[Fox Item Num] Is Null
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts