Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007.

Similar presentations


Presentation on theme: "1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007."— Presentation transcript:

1 1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007

2 2 Objectives Maintain a database Understand action queries Create an Update query Use a make table query Create a delete query

3 3 Objectives Construct a crosstab query Work with parameter queries Create find unmatched queries Understand find duplicate queries

4 4 Action Queries Change underlying table data  Select queried do not Can be used to create new tables Cannot be undone Play a large role in maintaining a database

5 5 About Update Queries Changes value(s) in one/ more records Use the Update query button  Database Tools tab, Query Type group Update button

6 6 Creating an Update query Identify record source Show desired tables in design grid Switch from Select to Update Query Insert Field to be updated Enter the value to be updated Value entered in Update To field Update value

7 7 Testing Action Queries Test all action queries before execution Choose Datasheet View  Allows preview of results before execution Check Datasheet View first

8 8 Running an Update Query Click the Run button  Design tab, Results group View table to see the results Run button Before Update query After Update query

9 9 Specifying Criteria in an Action Query Specified in the field being update Also specified using an additional field(s) Criteria

10 10 Using Criteria with an Update Query Specifies specific records for update Works the same as in a select query After update query with criteria Before update query with criteria Criteria

11 11 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 11 About Append Queries Adds records from one table to another Data types between tables must match Validation rules in existing table apply  Records not added if validation rule violated Source table fields may be ignored  Do not add to design grid If auto-number fields exists in target table  Do not import auto-number fields

12 12 Creating an Append Query Identify target and source tables Click Append button Choose Target table from Append box  May also browse to choose another database Append dialog box Append button

13 13 Creating an Append Query Add fields from Source table to design grid Test in Datasheet view Run query Fields to append added to design grid

14 14 Append Query Results Data is appended to existing table February Agents before append September Agents before and after append February Agents after append

15 15 About a Make Table Query Almost the same as append query  Table must preexist in append query  No pre-existing table in make table query Target database must exist

16 16 Creating a Make Table Query Identify the source table Click Make Table button Enter table name or choose database  Accomplished in the Make table dialog box Make Table dialog box Make Table button

17 17 Running a Make Table Query Add fields to design grid Test in Datasheet view Run query Fields added in design grid Test in Datasheet view

18 18 Make Table Query Results New table added to Objects pane Open table to view results Source Table Results of make table query

19 19 About Delete Queries Can delete all records from table  Criteria used to delete specific records  If no criteria, all records deleted Very powerful – cannot be undone Setup is same as other action queries

20 20 Creating a Delete Query Add table to Design grid Click Delete Button Add field(s) to design grid  Use criteria to specify delete conditions Add table to design grid Delete button Delete Query with criteria

21 21 Running a Delete Query Test query in Datasheet view Run Query Open table to view results Test in Design view Table before delete query Table after delete query

22 22 Hiding a Query Prevents accidental execution of action queries  Right-click query  Click the Hidden checkbox All queries shown Some queries hidden

23 23 About Crosstab Queries Summarizes by two sets of unrelated facts Output resembles a PivotTable  PivotTable primarily for management decision making  Crosstab query primarily for end users Will not work on related data Works with one or more tables

24 24 Crosstab Query – Using the Query Wizard Step 1 Click the Query Wizard button In the New Query dialog box  Select Crosstab Query Wizard Select Crosstab Query Wizard

25 25 Using the Query Wizard Step 2 Select table/query to use in crosstab To use fields from multiple tables  Create query from tables first Select source table or query to use

26 26 Using the Query Wizard Step 3 Select fields(s) for column headings Select field(s) for column headings

27 27 Using the Query Wizard Step 4 Select the field to calculate Select the appropriate aggregate function Select aggregate function

28 28 Using the Query Wizard Step 5 Enter new query name or accept default View or modify the query Enter new name or accept default name

29 29 Completed Crosstab Query Summarizes list price  Per selling/listing agent per city Source table Crosstab query

30 30 About Parameter Queries Information intentionally omitted by designer  Allows end user to supply criteria  Customizable data request More flexible than other query types Considered a select query Designers able to lock query design

31 31 Creating a Parameter Query Identify tables/ fields in design view Create prompt for user in criteria field  Prompt must be enclosed in brackets [ ]  Multiple fields can be used as prompts Message for user entered in brackets

32 32 Running a Parameter Query Click the Run button Enter criteria in message box  Criteria rules and use is same as normal select query View results in Datasheet view Message prompt with criteria entered Parameter query results

33 33 Parameter Report Normally based of a parameter query If not based on parameter query  Open reports source query in design view  Add parameter Or  View report in Design  Open property sheet for field  Click Record Source property - add parameter

34 34 About Unmatched Queries Compares records in two related tables Returns records found in only one table Query Wizard easiest method of creation Unmatched Query results

35 35 Unmatched Query Wizard Run Query Wizard Select Find Unmatched Query Wizard Find Unmatched Query

36 36 Unmatched Query Wizard Select first table source Select second table source Select first table source Select second table source

37 37 Unmatched Query Wizard Select the duplicate fields  Click the button Select display fields for query results Click Finish Select duplicate fields Select fields for query results

38 38 About Find Duplicates Query Finds duplicate data Aids in data entry error detection Allows administrative use of purposely duplicated data Easily created with the Query Wizard Query Wizard Find Duplicates query result


Download ppt "1 11 Chapter 7 Action Queries Exploring Microsoft Office Access 2007."

Similar presentations


Ads by Google