Share this Page URL
Help

Chapter 9. Extending Your Use of Queries > Running Action Queries - Pg. 321

Extending Your Use of Queries Sub ActionQuery () Dim db as Database Dim qry as QueryDef Set db = CurrentDb Set qry = db.QueryDefs("MyActionQuery") qry.Execute End Sub 321 Just the Steps Create an update query 1. 2. 3. 4. 5. 6. 7. 8. 9. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Start a new query in Design view. In the Show Table dialog box, add the tables you need in the query. From table field lists, add the fields you need in the query to the query design grid. On the Query menu, click Update Query. In the Update To row for the field or fields you need to update, enter the value you want or an expression that will calculate the new value. In the Criteria row, enter any criteria you need to select the records you want to update. Click the View button to open the query in Datasheet view and review the records that will be updated. Switch the query to Design view, and then click the Run button on the toolbar. Click Yes in the message box to update the records. Start a new query in Design view. In the Show Table dialog box, add the tables you need in the query. From table field lists, add the fields you need in the query to the query design grid. On the Query menu, click Append Query. In the Append dialog box, select the table you want the query to append records to. In the Append To row for each field you've added to the query, select the field in the target table to which the source data will be appended. In the Criteria row, enter any criteria you need to select the records you want to append. Click the View button to open the query in Datasheet view and review the records that will be appended. Switch the query to Design view, and then click the Run button on the toolbar. Click Yes in the message box to append the records. Create an append query Just the Steps Create a delete query 1. 2. 3. 4. 5. 6. 7. 8. Start a new query in Design view. In the Show Table dialog box, add the tables you need in the query. From table field lists, add the fields you need in the query to the query design grid. On the Query menu, click Delete Query. In the Criteria row, enter any criteria you need to select the records you want to delete. Click the View button to open the query in Datasheet view and review the records that will be deleted. Switch the query to Design view, and then click the Run button on the toolbar. Click Yes in the message box to delete the records. Quick Check Q. What steps can you take to safeguard your data before running an action query?