Training
Certification
Microsoft Office Specialist: Access Expert (Office 2019) - Certifications
Demonstrate that you have the skills needed to get the most out of Access 2019 by earning the Microsoft Office Specialist (MOS) Expert certification.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Access 2013, Office 2013
Creates a delete query that removes records from one or more of the tables listed in the FROM clause that satisfy the WHERE clause.
DELETE [table.*] FROM table WHERE criteria
The DELETE statement has these parts:
Part |
Description |
---|---|
table |
The optional name of the table from which records are deleted. |
table |
The name of the table from which records are deleted. |
criteria |
An expression that determines which records to delete. |
DELETE is especially useful when you want to delete many records.
To drop an entire table from the database, you can use the Execute method with a DROP statement. If you delete the table, however, the structure is lost. In contrast, when you use DELETE, only the data is deleted; the table structure and all of the table properties, such as field attributes and indexes, remain intact.
You can use DELETE to remove records from tables that are in a one-to-many relationship with other tables. Cascade delete operations cause the records in tables that are on the many side of the relationship to be deleted when the corresponding record in the one side of the relationship is deleted in the query. For example, in the relationship between the Customers and Orders tables, the Customers table is on the one side and the Orders table is on the many side of the relationship. Deleting a record from Customers results in the corresponding Orders records being deleted if the cascade delete option is specified.
A delete query deletes entire records, not just data in specific fields. If you want to delete values in a specific field, create an update query that changes the values to Null.
Important
This example deletes all records for employees whose title is Trainee. When the FROM clause includes only one table, you do not 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
Training
Certification
Microsoft Office Specialist: Access Expert (Office 2019) - Certifications
Demonstrate that you have the skills needed to get the most out of Access 2019 by earning the Microsoft Office Specialist (MOS) Expert certification.