DELETE Statement Example

This example deletes all records for employees whose title is Trainee. When the FROM clause includes only one table, you don't have to list the table name in the DELETE statement.

Sub DeleteX()

   Dim dbs As Database, rst As Recordset

   ' Modify this line to include the path to Northwind
   ' on your computer.
   Set dbs = OpenDatabase("Northwind.mdb")

   ' Delete employee records where title is Trainee.   
   dbs.Execute "DELETE * FROM " _
      & "Employees WHERE Title = 'Trainee';"
   
   dbs.Close

End Sub