Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at www.lexington1.net/AdultEd/computer/microsoft_access.htm.

Similar presentations


Presentation on theme: "Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at www.lexington1.net/AdultEd/computer/microsoft_access.htm."— Presentation transcript:

1 Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at www.lexington1.net/AdultEd/computer/microsoft_access.htm

2 Access Lesson 5 Review of Thursday’s Lesson Designing Forms Formatting Forms ActiveX Controls Creating Subforms 2

3 Access Lesson 5 Filtering by Form Access provides several ways to filter data To select precise subsets of information, use Filter by Form 3

4 Access Lesson 5 Filtering by Form Click the Filter by Form button A miniature of the table appears with blanks to enter selection criteria Mini-Table Criteria Tab 4

5 Access Lesson 5 Filter Toolbar New Object Undo Print Load From Query Spell Check Cut Paste Close Filter Window Apply Filter Help Database Window Clear Grid Save As Query Copy Format Painter 5

6 Access Lesson 5 Filtering by Form Enter the search criteria in the form Click the Apply Filter button Like “*Manager*” 6

7 Access Lesson 5 Filtering by Form When the filter is applied, all contacts who have “Manager” anywhere in their title are displayed Filter Applied 7

8 Access Lesson 5 Filtering by Form Mathematical criteria can also be applied >100 8

9 Access Lesson 5 Filtering by Form When the filter is applied, all products with more than 100 units in stock are displayed 9

10 Access Lesson 5 Applying More than One Filter More than one criterion can be used in the filter Add other criteria in the other blanks in the mini-table This is the “AND” logical condition >100 Condiments 10

11 Access Lesson 5 Applying More than One Filter When the filter is applied, all condiments with more than 100 units in stock are displayed 11

12 Access Lesson 5 Using the “OR” Property Click the “Or” tab at the bottom of the window This opens a new window with a new mini-table Enter criteria as before Grains/ Cereals Or Tab 12

13 Access Lesson 5 Using the “OR” Property When the filter is applied, all condiments with more than 100 units in stock and all grains/cereals products are displayed 13

14 Access Lesson 5 Advanced Filter/Sort For even more complicated sorting, select Records, then Filters, and choose Advanced Filter/Sort from the submenu 14

15 Access Lesson 5 Advanced Filter/Sort If a filter is currently in use, it will be shown in the window Fields to be filtered are shown in columns Filter conditions can be entered below the field name >50 15

16 Access Lesson 5 Advanced Filter/Sort When the filter is applied, all condiments with more than 100 units in stock and all grains/cereals products with more than 50 units in stock are displayed 16

17 Access Lesson 5 What is a Query? A set of explicit specifications to tell Access exactly what information (and in what format) the user wishes to see The result of a query is a dynaset, or dynamic subset of the records Example uses: View information from multiple tables sorted in a specific order Perform many types of calculations on selected groups of records Find and display duplicate or unmatched records Update data, delete records, or append new records to a table Create a new table with records from one or more tables 17

18 Access Lesson 5 Kinds of Queries Select Queries Simple Select: Displays information from one or more tables sorted in a specific order Find Duplicate: Displays all records with duplicate values in one or more specified fields Find Unmatched: Displays records in one table that have no related records in another table 18

19 Access Lesson 5 Kinds of Queries Special Purpose Queries Parameter: Displays a dialog box to enter criteria for retrieving information AutoLookup: Automatically fills in values in a new record Crosstab: Calculates a sum or counts and groups its results in spreadsheet format to correlate the data with two types of information 19

20 Access Lesson 5 Kinds of Queries Action Queries Update: Makes global changes to a group of records in one or more tables Append: Adds a group of records from one or more tables to the end of one or more other tables Delete: Removes a group of records from one or more tables Make Table: Creates a new table from data from one or more tables 20

21 Access Lesson 5 Kinds of Queries SQL-Specific Queries Union: Combines fields from one or more tables into one field in the result Pass-Through: Sends commands to an ODBC server Data-Definition: Creates or changes database objects in Access, SQL-Server, or databases on other servers Subqueries: SQL SELECT or other server statements that form a SELECT query within another query 21

22 Access Lesson 5 Filters vs. Queries Use a filter when: Working within one table Working on a temporary subset of the table’s records Use a query when: Records will come from more than one table You will “ask the same question” again You don’t want to have to open a table or form You want an answer calculated from the data in the table(s) You want to create a new table from the result 22

23 Access Lesson 5 Creating Queries In the “Queries” tab, click “New” Queries Tab New 23

24 Access Lesson 5 Simple Query Wizard To create a select query, choose the Simple Query Wizard Click “OK” 24

25 Access Lesson 5 Simple Query Wizard Queries can include fields from more than one table Products Table ProductName UnitsInStock Fields Suppliers Table CompanyName Field 25

26 Access Lesson 5 Simple Query Wizard Select the detail view if all fields will be shown Summary is for fields with numbers that can be manipulated 26

27 Access Lesson 5 Simple Query Wizard Choose a name for the new query Click “Finish” Choose to open the query and view information 27

28 Access Lesson 5 Simple Query Wizard The completed query gathers the requested information from related tables and presents it in compact form 28

29 Access Lesson 5 Sorting Queries in Design View If the information isn’t sorted to the user’s liking, it can be resorted Click the Design View button to see the query’s design Set the correct sort in the sort row of the column that the query should be sorted by Sort: Ascending 29

30 Access Lesson 5 Sorting Queries in Design View The query is resorted by Product Name, ascending 30

31 Access Lesson 5 Query Design Toolbar Help Database Window Build Show Table Run Print Preview Save Copy Format Painter Top Values New Object Undo Print View Spell Check Cut Paste Query Type Properties Totals 31

32 Access Lesson 5 Setting Query Criteria Criteria may be built using the Expression Builder This tool holds all the Tables and Queries, standard Access functions and common expressions, as well as buttons to add operators and logical statements 32

33 Access Lesson 5 Setting Query Criteria Click an operator button to enter it in the expression window Click on field names or functions to put them in the window Type other needed information using the keyboard Like “B*” Like “B*” 33

34 Access Lesson 5 Setting Query Criteria The effect of restricting products to those beginning with the letter “B” 34

35 Access Lesson 5 Crosstab Query To begin creating a crosstab query, create a simple query that contains the fields you want to include Select the Simple Query Wizard and click “OK” 35

36 Access Lesson 5 Crosstab Query Move from table to table collecting the fields that will be included in the eventual crosstab query A crosstab query must have at least four fields to work with Products Table Order Details Table Order Table 36

37 Access Lesson 5 Crosstab Query Continue to move through the query wizard 37

38 Access Lesson 5 Crosstab Query Choose a name for the new query Click “Finish” Choose to open the query and view information 38

39 Access Lesson 5 Crosstab Query The completed select query 39

40 Access Lesson 5 Crosstab Query Begin a new query, and select Crosstab Query Wizard Click “OK” 40

41 Access Lesson 5 Crosstab Query In this dialog box, select “Queries” and choose the new select query Just-Created Select Query View Queries 41

42 Access Lesson 5 Crosstab Query Select “ProductName” and CustomerID as Row Headings Row headings provide the row data and the sort order ProductName CustomerID Row Headings 42

43 Access Lesson 5 Crosstab Query Use OrderDate as the Column Heading The columns contain the time location of the data that will be tabulated OrderDate Column Headings 43

44 Access Lesson 5 Crosstab Query Choose to view the results by quarter Note that the column heading changes to quarters The quarter data is obtained automatically from the OrderDate field Quarter Column Headings 44

45 Access Lesson 5 Crosstab Query For the calculated part, choose “Sum” This will sum up the orders by Product by Customer by Quarter Sum Sum(Quantity) 45

46 Access Lesson 5 Crosstab Query Choose a name for the new crosstab query Click “Finish” Choose to open the query and view information 46

47 Access Lesson 5 Crosstab Query The completed crosstab query shows each product and the quantity that each customer purchased, both in total and by quarter 47

48 Access Lesson 5 Find Duplicates Query Begin a new query, and select Find Duplicates Query Wizard Click “OK” 48

49 Access Lesson 5 Find Duplicates Query Pick the fields likely to have duplicate entries City 49

50 Access Lesson 5 Find Duplicates Query Choose a name for the new query Click “Finish” Choose to open the query and view information 50

51 Access Lesson 5 Find Duplicates Query The completed query shows how many times each city appears in the customers table 51

52 Access Lesson 5 Unmatched Query Begin a new query, and select Find Unmatched Query Wizard Click “OK” 52

53 Access Lesson 5 Unmatched Query Select two related tables where there might be unmatched records 53

54 Access Lesson 5 Unmatched Query Select two related tables where there might be unmatched records 54

55 Access Lesson 5 Unmatched Query Indicate which field links the two tables Access attempts to do this automatically 55

56 Access Lesson 5 Unmatched Query Select all fields to be in the results 56

57 Access Lesson 5 Unmatched Query Choose a name for the new query Click “Finish” Choose to open the query and view information 57

58 Access Lesson 5 Unmatched Query In this instance, no unmatched data is found Referential integrity prevents unmatched data! 58

59 Access Lesson 5 Parameter Query Begin a new query, and select Design View Click “OK” 59

60 Access Lesson 5 Parameter Query Choose the table which will be searched 60

61 Access Lesson 5 Parameter Query Insert the fields that will be shown in the query In the “Criteria” line, enter the prompt in square brackets [ ] Click the “Run” button [Enter Contact Name] Type the value to be searched for 61

62 Access Lesson 5 Parameter Query The completed query finds the contact name and its related information 62

63 Access Lesson 5 Union Query A union query merges similar data into one field Union Queries are created by writing SQL statements Click the view button and choose SQL view SQL View 63

64 Access Lesson 5 Union Query The SQL view shows the statements that comprise the query All queries are really SQL statements; Access hides the details to make it easier for the user Space can be saved in the database by writing SQL rather than saving queries 64

65 Access Lesson 5 Review Filter by Form Using “And” and “Or” to Filter Advanced Filter/Sort Queries Select Queries Query Criteria Crosstab Queries Find Duplicates Queries Find Unmatched Queries Parameter Queries Union Queries 65


Download ppt "Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at www.lexington1.net/AdultEd/computer/microsoft_access.htm."

Similar presentations


Ads by Google