A “Delete Query” allows us to delete multiple records from a table.
An example: Suppose I want to remove all items that cost less than 100 Euro from the Products table.
First I connect the table. I select the “Create” tab in the “Ribbon” and click the “Query Design” button. In the “Show Table” dialog, select the table from which you want to delete the data, in this case the “Products” table.
Click the “Add” button and click the “Close” button.
Click the “Delete” button in the “Ribbon”. I add the “price” field to the grid. This is also the field where I want to make changes and give it the criteria <100 (less than 100).
Before you “Run” the “Query”, it might be a good idea to first look at the result of what you are going to remove. Click the “View” button in the “Ribbon” which brings us to the “Datasheet View” that shows us the records which are about to be removed. If you are satisfied, then click the “View” button again in the “Ribbon”.
This brings us back to “Design View”. Click the “Run” button in the “Ribbon”.
“Access” shows a warning window stating how many records you’re going to remove. Click on the “Yes” button when you are satisfied with this. Items with a price less than 100 Euro are removed from the table.
Once you have deleted records from a table, you can not undo this.
If you wish to remove all the records froma table in one pass, select the “Field” in the grid. Click the downward pointing arrow and choose the top option from the drop-down menu. This is the table name with a ‘*’ sign.
Click the “Run” button in the “Ribbon”.
You've completed Lesson 33 START NEXT LESSON