Download presentation
Presentation is loading. Please wait.
1
Analyzing Data and Creating Reports
Office Access 2003 Lab 3 Analyzing Data and Creating Reports
2
Objectives Filter table records Create and modify a query.
Move columns. Query two tables. Create reports from tables and queries.
3
Objectives continued Modify a report design.
Select, move, and size controls. Change paper margins. Preview and print a report. Compact and back up a database.
4
Concept Preview Filter Query Join Report Control
Filter - A filter is a restriction placed on records in the open datasheet or form to temporarily isolate and display a subset of records. Query - A query is a request for specific data contained in a database. Queries are used to view data in different ways, to analyze data, and even to change existing data. Join - A join is an association between a field in one table or query and a field of the same data type in another table or query. Report - A report is printed output generated from tables or queries. Control - Controls are objects on a form or report that display information, perform actions, or enhance the design.
5
Outline Filtering Records Using Filter by Selection
Using Filter by Form
6
Outline continued Querying a Database Using a Query Wizard
Moving Columns Modifying and Saving a Query Creating a Query in Design View Querying Two Tables Finding Unmatched Records Adding a Second Table to the Query
7
Outline continued Creating a Report from a Table
Using the AutoReport Wizard Using the Report Wizard Modifying the Report Design Selecting the Report Design Moving Controls Sizing Controls Previewing the Report Layout
8
Outline continued Creating a Report from a Query
Previewing and Printing Reports Changing Page Margins Printing an Entire Report Printing a Selected Page of the Report Compacting and Backing Up the Database
9
Outline Concept Summary Lab Review Lab Exercises
10
Filtering Records Doing sorts to find information can be time consuming A faster way to locate information in Access is to apply a filter to the table records Use filters when you want to see a subset of the records in your data base. A quick and easy way to view only the data you want to see.
11
Concept 1 Restriction placed on records
Filter Restriction placed on records Quickly isolates and displays a subset of records You specify a criteria Limiting conditions Temporary Filter Filter results can't be saved Filter criteria is saved with the table Filters: Use filters when you want to see a subset of the records in your data base A restriction placed on records in the open datasheet or form to quickly isolate and display a subset of records. Created by specifying a set of limiting conditions, or criteria, which you want records to meet in order to be displayed. Ideal when you want to display the subset for only a brief time and then return immediately to the full set of records. Print the filtered records as you would print any form or table. Temporary - all records are redisplayed when you remove the filter or close and reopen the table or form. Results cannot be saved. However, the last filter criteria you specify are saved with the table, and the results can be quickly redisplayed.
12
Using Filters Filter by Selection Filter by Form
Displays only records containing a specific value Effective when only one value is needed Other records are temporarily hidden Filter by Form Performs filters on multiple criteria Look For tab Or tab Filter by Selection - Effective when there is only one value in the table that you want Access to use as the criterion for selecting and displaying records. Placing the insertion point in a field selects the entire field contents. The filtered subset will include all records containing an exact match. Selecting part of a value in a field (by highlighting it) displays all records containing the selection. For example, in a table for a book collection, you could position the mouse pointer anywhere in a field containing the name of the author Stephen King, choose the Filter by Selection command, and only records for books whose author matches the selected name, Stephen King, would be displayed. Selecting the last name King would include all records for authors Stephen King, Martin Luther King, and Barbara Kingsolver. To use: Select field Click Filter by Selection. ANOTHER METHOD: Records/Filter/Filter by Selection Filter by Form - allows you to perform filters on multiple criteria For example - you want to filter the employee data by two cities, Los Angeles and Santa Barbara. Click Filter by Form – the Form window displays a blank version of the current datasheet with empty fields You specify the criteria ANOTHER METHOD: Records/Filter/Filter By Form
13
Using Filters Criteria expression AND operator OR operator
Typing a value directly in its corresponding field Select value from drop down list AND operator OR operator Use filters to search for multiple conditions: Criteria expression - What specific data you want it to use for the filter criteria. Can instruct the filter to locate records meeting multiple conditions: AND operator – A record meeting all the conditions is included and is the default operator. OR operator – Any record meeting either condition is included. Use the OR tab, or by typing “or” between criteria in the same field. Note: Make sure that students understand the difference between a query and a filter. Both limit searches for records, but queries are more powerful and can do calculations as well as update the records in the database.
14
Filter by Selection Filter by selection
Filter displays only those record meeting the criteria of city of Maldin Placing the insertion point in a field selects the entire filed contents. The filtered subset will include all records containing an exact match. All other records are temporarily hidden.
15
Filter by Form Filter by Form allows you to perform filters on multiple criteria. The above example shows filtering the employee data by two cities, Chesterfield and Maldin. A blank version of the current datasheet with empty fields is displayed. Enter values in the blank field spaces of the record row as criteria expressions. Criteria expression is an expression that will select only the records that meet certain limiting criteria. Type a value or use the drop-down list to select a value. The above example uses OR to find either city.
16
Querying A Database A query is a request for information
View data in different ways Analyze data Change existing data Can be used as a source for forms and reports Ask students how they would look for data with a manual filing system. Point out the benefits of using queries.
17
Concept 2 Query Type Description Query Select query
Retrieves specific information Crosstab query Summarizes large amount of data Parameter query Prompts for criteria information Action query Makes changes to many records SQL query Advanced query using Structured Query Language Select - Retrieves the specific data you request from one or more tables, then displays the data in a query datasheet in the order you specify. This is the most common type of query. Crosstab - Summarizes large amounts of data in an easy-to-read, row-and-column format. Parameter - Displays a dialog box prompting you for information, such as criteria for locating data. For example, a parameter query might request the beginning and ending dates, then display all records matching dates between the two specified values. Action - Makes changes to many records in one operation. There are four types of action queries: A make-table query creates a new table from selected data in one or more tables. An update query makes update changes to records, such as when you need to raise salaries of all sales staff by 7 percent. An append query adds records from one or more tables to the end of other tables. A delete query deletes records from a table or tables. SQL- Created using SQL (Structured Query Language), an advanced programming language used in Access.
18
5 methods to create queries
Ways to Create a Query 5 methods to create queries Review the five ways to create a query
19
Using a Query Wizard Query Wizard Type of Query Created Simple
Select query Crosstab Crosstab query Find Duplicates Locates duplicate values in one or more fields Find Unmatched Locates records in one table that do not have records in another
20
Using a Query Wizard Steps
Select underlying table and fields Specify a name for your query Select to open as is or in Design view If possible, demonstrate how to create a query using the wizard.
21
Simple Query Underlying table to be used as the data source
Specify fields to include in query output Underlying table to be used as the data source Starting with the wizard is a good way to understand how a query works. Most users begin using a simple, Select Query.
22
Adding Fields to the Query
Adds all fields Adds field Removes field Removes all fields 5 fields to include in query output Using the Wizard, select all the fields you need in your query
23
Query datasheet displays 5 selected fields for all records
Completed query shows only the 5 fields selected. Query is displayed in a query datasheet.
24
Moving Columns Last Name column moved
To move a column select it and then drag it to its new location. Changing the column order in the query datasheet does not affect the field order in the table, which is controlled by the table column.
25
Modifying a query To modify a query, you make changes in the Query Design view window The Design window has two areas Upper area includes Field list Lower area includes Design grid Column selector Row label Cell Show boxes The Query Design view is used to create and modify the structure of the query. This view automatically displays a Query Design toolbar that contains the standard buttons as well as buttons that are specific to the Query Design view window. The window is divided into two sections Field list – upper section displaying a list of all fields Design grid – lower section where you enter settings that define the query Column selector – used to select columns (fields) Row label – identifies the type of information to be entered Cell –intersection of a column and a row where you enter expressions to obtain the query results you need Show boxes – lets you specify whether you want a field displayed in the query results
26
Query Design View Window
Raw labels Column selector bar Design grid Cell Employee Records table field list Checked Show box indicates the field will be displayed in query results To display the query results, you RUN the query (Exclamation Point icon).
27
Criteria expression enclosed in quotation marks
Using an Expression Runs query Criteria expression enclosed in quotation marks In the Criteria row of the column, enter a criteria expression to select only those records. The expression is enclosed in quotation marks because it is a character string.
28
Query Database Display
Query database displays all records with a city field of Maldin The query displays only those records meeting the criterion.
29
Creating a Query in Design View
Select table to use as data source Open the Query Design window. Select table to use from the Show Table dialog box. A field list for the selected table appears above the design grid. Select the fields you want in your query by dragging the filed to the grid. Enter any criteria that each field must meet to be included in the query. Run the query. Query datasheet will display only those records meeting the criterion. Print the query. Save the query if results are needed. Save the query design specifications.
30
Selecting Fields for Query
Select fields from field list to add to grid There are three ways to select fields for a query: Select the field name and drag it from the field list to the grid Double-click on the field name The field is added to the next available column Select the Field cell drop-down arrow in the grid, and then choose the field name
31
Data criterion entered
Using an Expression Data criterion entered <=1/1/00 Enter the expression in the Criteria cell The results will include only those records that meet this criteria
32
Records Meeting Criteria
Employees hired on or before 01/01/2000 Records meeting criteria
33
Saving Queries Saved Queries
Save As will save an existing object using a new name
34
Querying Two Tables To bring together two tables in a query, you create a join between the tables
35
Concept 3 Join An association between a field in one table or query and a field in another table or query Must have at least one common field Fields must be the same data type Used to bring information from different tables together Joins are what make relational databases so powerful A query is a request for information Can view data in different ways Can analyze data Can change existing data Used as a source for forms and reports
36
Finding Unmatched Records
Selected table is searched for records Use this type of query to locate missing records from a table. Compares one table to another.
37
Finding Unmatched Records
Matching field is selected in the two tables In the first Wizard dialog box, you select the table that contains records you want to appear in the results. In the second dialog box, you will select the table to compare the first table to. This establishes the join between the tables. The third step is to identify the matching fields.
38
Finding Unmatched Records
Two records are found that are missing from Clubs table The two records in the Employee Records table that do not have a matching record are displayed in the query results.
39
Adding a Second Table to the Query
Add table to query Create a query using Design View To add additional tables, use the Show Table option
40
Join line links common field
When you add multiple tables to a query, Access automatically joins the tables based on the common fields if one of the common fields is a primary key. If the common fields have different names, Access does not automatically create the join. Instead you create the join by manually dragging from one common field to the other.
41
Field from second table added to grid
Adding Fields to Join Field from second table added to grid Criteria entered
42
Records are a result of the combination of fields from both tables
Run the Query Records are a result of the combination of fields from both tables
43
Joins Join Type Description Inner join Outer join SQL join
Checks records for matching values and displays them as one record in the query results. Outer join One table contributes all of its records even if the values in its joined field do not math those in the other table. SQL join Records to be included are based on the value in one join field being greater than, equal to, etc. the value in the other join field Inner join - Checks records for matching values, and when it finds matches combines the records and display them as one record in the query results. Outer join - Each matching record from two tables is combined into one record in the query results. One table contributes all of its records even if the values in its joined field don’t match the field values in the other table. Include all records from a table and only those from the second table where the joined fields are equal. If possible,show students how to join two tables using a query. Point out the default join line that joins the two common fields.
44
Creating a Report from a Table
Access provides an easy to use tool to create reports
45
Concept 4 Printed output generated from tables or queries
Report Printed output generated from tables or queries All fields or selected fields Can be based on a table or query Can customize: Text formats Styles Layouts Grouping Summary information A report is printed output generated from tables or queries: Can create a simple listing of all the fields in a table Can be a list of selected fields based on a query A custom report enables you to create professional-appearing reports. The custom report is a document that includes text formats, styles, and layouts that enhance the display of information. Can group data in reports to achieve specific results. You can then display summary information, such as totals, by group to allow the reader to further analyze the data.
46
Creating a Report 6 methods to create a report
Specify table or query as source for the report 6 methods to create a report To create a report, open the New Report dialog box
47
Using the AutoReport Wizard
Report title Report displayed in Print Preview Columnar report displays each field on a separate line The AutoReport Wizard creates a report that displays all fields and records from the underlying table or query in a predesigned report layout and style.
48
Fit to Windows Photo placeholder
Click on the page to change the magnification to Fit
49
Previewing Multiple Pages
One record per page Click multiple pages
50
Using the Report Wizard
Specify tables/queries and fields to use in reports The Report Wizard lets you choose the fields to include in the report and helps you quickly format and lay out the new report. In this example, the Wizard will be used to create a report that displays the field contents for each record on a line rather than a column.
51
Grouping the Data The data can be grouped by category.
52
Selecting Sort and Sort Order
The report can be sorted on one to four fields.
53
Report Layout & Orientation
Creates a tabular layout report in portrait orientation The dialog box is used to change the report layout and orientation.
54
Report Style The preview area displays a sample of each style as it is selected
55
Tabular report in Corporate style
Completed Report Tabular report in Corporate style Field names When asked to name the report, use something descriptive since it will be displayed on the report as the title.
56
What's the difference between the two wizards?
Creating Reports AutoReport Wizard Report Wizard What's the difference between the two wizards? To create a report, open the New Report dialog box Ways to create a report: From scratch in Design view By using the Report Wizard - the Report Wizard lets you choose the fields to include in the report and helps you quickly format and lay out the new report. By using AutoReport Wizard; the AutoReport Wizard creates a report that displays all fields and records from the underlying table or query in a predesigned report layout and style.
57
Modifying the Report Design
Open the Report Design View Used to create and modify the structure of a report Displays three toolbars Report Design Formatting Toolbox Field List box contains fields that can be added to the report The Report Design view is used to create and modify the structure of a report. This view automatically displays three toolbars: Report Design - Contains the standard buttons as well as buttons that are specific to the Report Design view window Formatting - Contains buttons that allow you to make text enhancements Toolbox - A movable box that contains buttons used to add and modify report design objects
58
Modifying the Report Report Design toolbar Formatting toolbar
Field List box Toolbox toolbar Report Design toolbar Formatting toolbar Any report created with a Wizard can be modified. Open the Design View of the report.
59
Report Controls Controls are objects on a form or report that display information, perform actions, or enhance the design.
60
Modifying the Reports Design
Section Description Report Header Contains information to be printed once at the beginning of the report. Page Header Contains information to be printed at the top of each page. Detail Contains the records of the table. Page Footer Contains information to be printed at the bottom of each page. Report Footer Contains information to be printed at the end of the report. The Report Design window is divided into five sections: Report Header Page Header Detail Page Footer Report Footer
61
Concept 5 Controls are objects on a form or report
Display information Perform actions Enhance the design Two basic types of controls: Bound Unbound Last Name Smith Unbound label Bound text box Controls are objects on a form or report that display information, perform actions, or enhance the design. Access provides controls for many types of objects, including labels, text boxes, check boxes, list boxes, command buttons, lines, rectangles, option buttons, and more. There are two basic types of controls: A bound control is linked to a field in an underlying table. An example of a bound control is a text box that creates a link to the underlying source (usually a field from a table) and displays the field entry in the report or form. An unbound control is not connected to a field. Examples of unbound controls are labels, which can be taken from the underlying table associated with a text box or customized with descriptive titles or user instructions. Other unbound controls contain elements that enhance the appearance of the form, such as lines, boxes, and pictures. A text box can also be an unbound control if it’s used for user input or to display calculation results.
62
Access Objects With Controls
Command buttons Lines Rectangles Option buttons Labels Text boxes Check boxes List boxes Labels – Names of table fields; like a caption Text boxes – Names of data in the field; data bound to the table Check boxes – Used to check yes or no for an entry List boxes – Show a list of possible values for a field Command buttons – Buttons that are tied to commands like SAVE, FIND, PRINT, etc. Lines - Lines that can enhance the appearance of a form or a report Rectangles – Can be used as a border around labels and text boxes Option buttons – Used to select one of several value options for data entry for a field
63
More on Controls Selecting controls Moving controls Sizing controls
Modifying and Moving controls You need to select controls in order to modify them The control is surrounded by eight small boxes called sizing handles that indicate the control is selected; sizing handles are used to size the control. A large box in the upper left corner is displayed. This is a move handle that is used to move the selected control.
64
Selected label and text box controls
Selecting Controls Move handles Selected label and text box controls When you select a bound control, both the label and the data controls are selected. Each selected control is surrounded by eight small boxes called sizing handles. The sizing handles are used to size the control. Also, a large box in the upper left corner is displayed. This is the move handle that is used to move the selected control.
65
Label and text box controls moved
Moving Controls Label and text box controls moved Modifying and Moving controls Controls are moved by dragging them to the new location. The mouse pointer changes shape (to a hand) to indicate that a selected control can be moved Shape to move control
66
Control sized to display contents
Sizing Controls Control sized to display contents When you position the mouse pointer on a sizing handle, the pointer changes to a bi-directional arrow. The direction of the arrow indicates in which direction dragging the mouse will alter the shape of the object.
67
Previewing the Report Layout
Layout Preview displays only some of the records Using Layout Preview generates the preview faster because it displays only the first page of the report and some of the records
68
Creating a Report From a Query
Reports can be created from tables and from queries. You can use the report wizard to create a report from a query.
69
Report based on a Query Using a query instead of a table gives you only the fields and information needed for the report.
70
Previewing and Printing Reports
To make the report fit, you may need to adjust the page margins On the Preview screen, click Setup.
71
Other Print Features Change page margins
Print a selected page of a report When you’re making a lot of design changes to a report, it’s a good idea to periodically check how the printed output will look. If you need to make further adjustments, you can return to design view. Other adjustments can be made using the print page setup options. Caution students on increasing the size of controls. A large size could result in blank pages being printed for a report since the overall report will increase Decrease control or adjust the margin – blank space around the edge of a page to trouble shoot printing problems
72
Compacting and Backing up the Database
Makes a copy of the file Rearranges how the file is stored on disk Makes database perform optimally Compacting is important because: Database becomes fragmented due to deletes Space not used efficiently Backup your databases periodically A file is fragmented when it becomes too large for your computer to store in a single location on your hard disk. When this happens, the file is split up and stored in pieces in different locations on the disk, making it slower to access. Compacting a database should be done regularly. Backup your databases periodically as this will ensure that you have a copy incase of a power outage or other system failures while you are working on a file, or in case you need to access a previous version of database that you have changed.
73
Key Terms AND operator bound control column selector bar common field
compact control criteria criteria expression design grid field list filter
74
Key Terms continued Filter by Form Filter by Selection join join line
margin move handle multitable query OR operator query query datasheet
75
Key Terms continued report row label Show box sizing handles
unbound control
76
FAQs What's the difference between Filter by Selection and Filter by Form? How do I remove a filter? What is required to create a query? I created a query, and entered a criteria, but no records were selected. Did I do something wrong?
77
FAQs Running a query does not save the results, but I want to run my query again. What should I do? What is a join and when should I use a one? What is the difference between forms and reports?
78
FAQs I am not sure how to create a report. What should I do?
I want to change my report. What do I need to know about the controls? I created a report and want to print out the first few pages. How can I do this?
79
Discussion Questions Discuss what filters are and how they can be used in a database. When would it be appropriate to use a filter? Discuss the differences between the AND and OR filter conditions.
80
Discussion Questions Discuss what a query can do and some advantages of using queries. Discuss the different types of controls. Give an example of how they can be used to create different report designs.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.