Delete

Delete records from one or more of the tables listed in the FROM clause that satisfy the WHERE clause (SQL).

Syntax
      DELETE [DISTINCTROW] [table.*] FROM table WHERE criteria

Key
   table     The name of the table from which records are deleted.

   criteria  An expression that determines which records to delete.

If when running a delete query you recieve the error; "Could not delete from the specified tables" this often means that you need to use DELETE DISTINCTROW or in the GUI set the query’s 'Unique Records' property to YES

Examples

In SQL
DELETE * FROM Employees WHERE Title = 'Trainee';

In VBA 'Open a database
Set dbs = OpenDatabase("C:\demo\Northwind.mdb")
' Delete employee records where title is Trainee.
dbs.Execute "DELETE * FROM Employees WHERE Title = 'Trainee';"
dbs.Close

“To finish a work? To finish a picture? What nonsense! To finish it means to be through with it, to kill it, to rid it of its soul, to give it its final blow the coup de grace for the painter as well as for the picture” ~ Pablo Picasso

Related

Insert - Add records to a table (append query).
Select - Retrieve data from one or more tables or queries.
Update - Update existing field values in a table.


 
Copyright © 1999-2024 SS64.com
Some rights reserved