Download presentation
Presentation is loading. Please wait.
1
Microsoft® Office Access® 2007 Training
ICT Staff Development presents: Microsoft® Office Access® 2007 Training [Notes to trainer: This course is the fourth in a series about creating a Microsoft Office Access 2007 database. Students should be familiar with the basics of designing and creating database tables and building relationships between tables. They can also the training courses titled, “Build a database I: Design tables for a new Access database,” “Build a database II: Create tables for a new Access database,” and “Build a database III: Build relationships for a new Access database.” For detailed help in customizing this template, see the very last slide. Also, look for additional lesson text in the notes pane of some slides.] Build a database IV: Create queries for a new Access database
2
Build a database IV: Create queries for a new Access database
Course contents Overview: Ask your data — create queries Lesson: Get answers from your data Each lesson includes a list of suggested tasks and a set of test questions. Build a database IV: Create queries for a new Access database
3
Overview: Ask your data — create queries
It’s time to create queries, one of the most powerful tools in your database. Say you want to know how many computers you own. You can build a query to fetch that data and total the numbers. Queries can also provide data for your forms and reports, which can help make your database easier to build and use. This course introduces queries and explains how to create the most common type, a select query. The scenario: So far in this series, you’ve designed and built the tables for an asset-tracking database, and you’ve created relationships that allow your tables to “talk” with one another. Note: This course builds on the first three in the series, but still assumes you’re new to Access and databases. Build a database IV: Create queries for a new Access database
4
Build a database IV: Create queries for a new Access database
Course goals Use the Query Designer to create a select query that returns data from a single table. Create a select query that asks you to enter parameters, then returns results that match those parameters. Use a formula in a query to calculate a sum. Use the Query Wizard to create a select query that returns data from two tables. Use a text expression to concatenate fields. Build a database IV: Create queries for a new Access database
5
Get answers from your data
Lesson Get answers from your data
6
Get answers from your data
Your new asset- tracking database is coming along. You have tables, relationships, and data, so the next step is to build some queries. Specifically, you’ll create select queries. They’re components that retrieve and process your data and display the results in a datasheet. The query in the picture takes asset data from the first table, the names of technicians from the second table, and displays the result in a way that you can consume. Once again, the queries will help you answers some important questions, and make it easier to create forms and reports. Example of a select query: If you want to know who to call when a computer needs repair, you create a query that extracts the relevant names and phone numbers. Let’s start by looking at the parts of a query. Build a database IV: Create queries for a new Access database
7
The basics of creating select queries
Access provides two primary ways to create select queries — the Query Wizard and the Query Designer. Regardless of the tool you use, you follow some common steps to create the query. Start by choosing a recordsource for the query. A recordsource can be one or more tables, one or more queries, or a combination of the two. From the recordsource, select the fields that you want to see in the query. The picture shows a table open in the Query Designer. The picture also shows fields in the Query Designer, but you do the same thing in the Query Wizard. Build a database IV: Create queries for a new Access database
8
The basics of creating select queries
Access provides two primary ways to create select queries — the Query Wizard and the Query Designer. Regardless of the tool you use, you follow some common steps to create the query. Add any sorting, filtering, or other selection criteria to your queries. For example, if you use the criteria shown in the picture, the query will only return data for assets purchased after May First of 2010. In step 3, you can also use criteria that make a query ask you for input before it runs. You’ll see that later in this course. You can refine your query by adding or removing fields, or by changing your selection criteria until you have just the data you need, and then you can put the query to work. That’s next. After you finish adding fields and any selection criteria, run your query to see if it gives you the correct results. Build a database IV: Create queries for a new Access database
9
Ways to use query results
When you run a select query, Access displays the results in a datasheet. The result is called a recordset, and you can work with it in the same way that you work with a datasheet. For example, you can add or change data, and Access will write your changes to the tables that serve as the recordsources for your query. Build a database IV: Create queries for a new Access database
10
Ways to use query results
You can also use your recordsets to provide data for forms, reports, and even other queries. For example, if you want a report on the computers that you need to replace, you can create a query that returns that data, and then quickly build your report. The picture shows this. The query returns only those records where an asset has been marked for retirement. The final two courses in this series, available in the coming weeks, will show you how to create forms and reports that use queries as data sources. For now, remember that unlike tables, recordsets don’t physically exist in your database. Instead, Access stores the query, and it only displays a recordset when you run the query. Next: Let’s build one. We’ll start with the Query Designer. Build a database IV: Create queries for a new Access database
11
Query a single recordsource
The Query Designer gives you the most control over a select query. It also makes it easy to create a query that uses a single table as a recordsource. Build a database IV: Create queries for a new Access database
12
Query a single recordsource
For example, this type of query makes it easy to list your assets and their purchase dates, as shown here. On the Create tab, in the Other group, click Query Design. The designer starts and displays the Show Table dialog box. In the dialog box, select your recordsource. You can use a combination of tables and queries, and the ones you select appear in the upper section of the designer. Build a database IV: Create queries for a new Access database
13
Query a single recordsource
For example, this type of query makes it easy to list your assets and their purchase dates, as shown here. In your recordsource, double-click the fields that you want to see in your recordset, or results. Your choices appear in the bottom section of the designer. When you finish adding fields, go to the Design tab on the Ribbon, and in the Results group, click Run. Your record then appears as a datasheet. Build a database IV: Create queries for a new Access database
14
Make a query ask you for input
The type of query that you created in the previous section can return a lot of data. A common way to limit what the query returns is to use a parameter. Put simply, parameters make the query ask for input before it runs. So if, say, you only want to see records between certain dates, you can add parameters that make the query ask you for starting and ending dates. The query will give you just the records that fall between those dates. Build a database IV: Create queries for a new Access database
15
Make a query ask you for input
In other words, parameters are a type of filter that you build in to your query. Open the query in Design view, and in the Criteria row of the field you want to filter, enter your parameter. When you run the query, that criteria asks you for a start date, then an end date, and it returns only the records that fall within the dates you specify. Step 1: For example, you can use the criteria shown in the picture. Criteria can become complex; the Quick Reference Card that’s linked to at the end of the course has pointers to more information about using them. Build a database IV: Create queries for a new Access database
16
Build a database IV: Create queries for a new Access database
Use a formula in a query Another common way to alter the selection criteria in a query is to add a function. For example, if you want to know how much your company spent on office furniture last year, you can add an aggregate function to the query and the sum will appear in your results. Build a database IV: Create queries for a new Access database
17
Build a database IV: Create queries for a new Access database
Use a formula in a query The picture shows the process. Open your query in Design view. On the Design tab, in the Show/Hide group, click Totals. The Total row appears in the designer. In the field where you want to use the function, click the Total row and select a function from the list. Build a database IV: Create queries for a new Access database
18
Build a database IV: Create queries for a new Access database
Use a formula in a query The picture shows the process. When you run your query, the results include your calculation. Next, let’s look at creating a select query that uses more than one table. Build a database IV: Create queries for a new Access database
19
Query multiple recordsources
Finally, you can use multiple tables, or other queries, as the recordsource for a new query. The Query Wizard is the easiest way to do that type of job, especially if you’re new to Access. This type of query is a way to answer questions such as which assets came from which suppliers. Note: Remember that any tables in the recordsource must participate in a relationship. If the tables aren’t related, the query gives you all the data from each table, and your results won’t mean anything. For example, you can’t extract the names of your employees from one source and the assets that they use from another unless those tables are related. Build a database IV: Create queries for a new Access database
20
Query multiple recordsources
The picture shows the process. On the Create tab, in the Other group, click Query Wizard. Complete the wizard. As part of that process, select the tables and fields you want to use as your recordsource, and ... Build a database IV: Create queries for a new Access database
21
Query multiple recordsources
The picture shows the process. Give your new query a descriptive name. Remember to avoid using spaces in the name. Build a database IV: Create queries for a new Access database
22
Suggestions for practice
Create a select query from a single table. Make the query ask you for input (add a parameter to the query). Add a calculated field to the query. Create a query from multiple tables. [Note to trainer: With Access 2007 installed on your computer, you can click the link in the slide to go to an online practice. In the practice, you can work through each of these tasks in Access, with instructions to guide you. Important: If you don’t have Access 2007, you won’t be able to access the practice instructions.] Online practice (requires Access 2007) Build a database IV: Create queries for a new Access database
23
Build a database IV: Create queries for a new Access database
Test question 1 When you first create a query, you select which of the following? (Pick one answer.) A recordsource. A system table. A recordset. Build a database IV: Create queries for a new Access database
24
Build a database IV: Create queries for a new Access database
Test question 1: Answer A recordsource. The recordsource can be a combination of tables and queries. Build a database IV: Create queries for a new Access database
25
Build a database IV: Create queries for a new Access database
Test question 2 Use criteria in a query when you need to do which of the following? (Pick one answer.) Ensure your data is properly formatted. Add formulas to a table. Sort, filter, or otherwise limit what the query returns. Build a database IV: Create queries for a new Access database
26
Build a database IV: Create queries for a new Access database
Test question 2: Answer Sort, filter, or otherwise limit what the query returns. Criteria can be quite powerful, too. For example, you can use criteria to find records for people who live in a given city and have birthdays that fall between dates that you specify. Build a database IV: Create queries for a new Access database
27
Build a database IV: Create queries for a new Access database
Test question 3 Before you can use multiple tables as a recordsource, those tables must be or do which of the following? (Pick one answer.) Be open in Datasheet view. Participate in a relationship. Not serve as the recordsource for another query. Build a database IV: Create queries for a new Access database
28
Build a database IV: Create queries for a new Access database
Test question 3: Answer Participate in a relationship. If the tables don’t participate in a relationship, the query returns all the data in each table, and the results are almost always meaningless. Build a database IV: Create queries for a new Access database
29
Build a database IV: Create queries for a new Access database
Quick Reference Card For a summary of the tasks covered in this course, view the Quick Reference Card. Build a database IV: Create queries for a new Access database
30
Using This Template This Microsoft Office PowerPoint® template has training content about creating queries, one of the most powerful tools in a Microsoft Office Access 2007 database. It’s geared for you to present to a group and customize as necessary. This template’s content is adapted from the Microsoft Office Online Training course called “Create queries for a new Access 2007 database.” Features of the template Title slide: On the very first slide, there is placeholder text over which you should type the name of your company. Or you can delete the text box altogether if you don’t want this text. Animations: Custom animation effects are applied throughout the presentation. These effects include Peek, Stretch, Dissolve, and Checkerboard. All effects play in previous versions back to Microsoft PowerPoint To alter animation effects, go to the Slide Show menu, click Custom Animation, and work with the options that appear. If this presentation contains an Adobe Flash animation: To play the Flash file, you must register a Microsoft ActiveX control, called Shockwave Flash Object, on your computer. To do this, download the latest version of the Adobe Flash Player from the Adobe Web site. Warning about saving the Flash animations: The Flash animations will play in versions back to PowerPoint However: If you want to save this template in PowerPoint 2007, save it in the earlier PowerPoint file format: PowerPoint Presentation (*.ppt) or PowerPoint Template (*.pot). (You’ll see the file types in the Save As dialog box, next to Save as type.) If you save it in a PowerPoint 2007 file format, such as PowerPoint Presentation (*.pptx) or PowerPoint Template (*.potx), the animations won’t be retained in the saved file. Slide transitions: The Wipe Down transition is applied throughout the show. If you want a different one, go to the Slide Show menu, click Slide Transition, and work with the options that appear. Hyperlinks to online course: The template contains links to the online version of this training course. The links take you to the hands-on practice session for each lesson and to the Quick Reference Card that is published for this course. Please take note: You must have Access 2007 installed to view the hands-on practice sessions. If you don’t have Access 2007, you won’t be able to access the practice instructions. Headers and footers: The template contains a footer that has the course title. You can change or remove the footers in the Header and Footer dialog box (which opens from the View menu). USING THIS TEMPLATE See the notes pane or view the full notes page (View menu or tab) for detailed help on this template.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.