Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

MS Access action query


May 16, 2021 MS Access


Table of contents


In MS Access and other DBMS systems, queries can do more than just display data, but they can actually perform various operations on the data in the database.

  • An action query is a query that can add, change, or delete multiple records at once.

  • Another benefit is that you can preview the results of the query in Access before you run it.

  • Microsoft Access offers 4 different types of action queries -

    • Additional

    • Update

    • Delete

    • Build the table

  • The action query cannot be undone. You should consider backing up any tables that will be updated by using update queries.

Create an append query

You can use append queries to retrieve data from one or more tables and add that data to another table. L et's create a new table where we'll add data from the tblEmployees table. This will be a temporary table for demonstration purposes.

Let's call it TempEmployees, which contains the fields shown in the screenshot below.

MS Access action query

MS Access action query

In the Display Table dialog box on the Table tab, double-click the tblEmployees table, and then close the dialog box. Double-click the field you want to display.

MS Access action query

Let's run the query and show the data first.

MS Access action query

Now let's go back to the query design and select the Attach button.

MS Access action query

In Query Type, select the Attach option button. This displays the following dialog box.

MS Access action query

Select the table name from the drop-down list, and then click OK.

MS Access action query

In the query grid, you can see that in Attach to row, all fields are selected by default, except Address1. b21> not available in the TempEmployee table. S o we need to look at the Address field.

MS Access action query

Let's look at the address field.

MS Access action query

Now let's run the query and you'll see the following confirmation message.

MS Access action query

Click Yes to confirm your action.

MS Access action query

When you open the TempEmployee table, you will see all the data added to the TempEmployee table from tblEmployees.