1 / 34

Microsoft ® Access ® 2010 Training

Microsoft ® Access ® 2010 Training. Create queries for a new database. Course contents. Overview: Queries are essential Lesson : Includes seven sections Suggested practice tasks Test Quick Reference Card. Overview: Queries are essential.

reid
Download Presentation

Microsoft ® Access ® 2010 Training

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Microsoft® Access®2010 Training Create queries for a new database

  2. Course contents • Overview: Queries are essential • Lesson: Includes seven sections • Suggested practice tasks • Test • Quick Reference Card Create queries for a new database

  3. Overview: Queries are essential In this course, you’ll learn how to create queries for an Access database. Queries are an essential part of any database. They’re how you extract meaningful information from your database and answer key business questions. This is the fourth course in a series that teaches beginners how to use Access 2010. Create queries for a new database

  4. 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 and 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 an expression to concatenate fields. Create queries for a new database

  5. Get answers from your data The building blocks of a select query. Your new asset-tracking database is coming along. You have tables, relationships, and data, so the next step is to build some queries. They’ll help you answer important questions, and they’ll make it easier to create forms and reports. Create queries for a new database

  6. Get answers from your data For example, 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. The building blocks of a select query. Specifically, you’ll create select queries. They’re components that retrieve and process your data and display the results in a datasheet. Create queries for a new database

  7. Get answers from your data Let’s start by looking at the parts of a query. The building blocks of a select query. That’s what the picture shows. The query 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. Create queries for a new database

  8. The basics of creating select queries The basic process for creating a query. Access provides two primary ways to create select queries — the Query Designer and the Query Wizard. Regardless of the tool you use, you follow some common steps when you create a select query. Create queries for a new database

  9. The basics of creating select queries The basic process for creating a query. Start by choosing a record source for the query. A record source can be one or more tables, one or more queries, or a combination of the two. The picture shows a table open in the Query Designer. From the record source, select the fields that you want to see in the query. The picture shows fields in the Query Designer, but you do the same thing in the Query Wizard. Create queries for a new database

  10. The basics of creating select queries The basic process for creating a 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. You can also use criteria that make a query ask you for input before it runs; you’ll see that later in this course. After you finish adding fields and any selection criteria, run your query to see if it gives you the correct results. Create queries for a new database

  11. Ways to use query results For example, you can add or change data, and Access will write your changes to the tables that serve as the record sources for your query. A query as the data source for a report. When you run a select query, Access displays the results in a datasheet. The result is called a record set, and you can work with it in the same way that you work with a datasheet. Create queries for a new database

  12. Ways to use query results The picture shows this. The query returns only those records where an asset has been marked for retirement. A query as the data source for a report. You can also use your record sets 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. Create queries for a new database

  13. Ways to use query results So let’s build one. We’ll start with the Query Designer. A query as the data source for a report. The final two courses in this series show you how to create forms and reports that use queries as data sources. For now, remember that unlike tables, record sets don’t physically exist in your database. Instead, Access stores the query, and it only displays a record set when you run the query. Create queries for a new database

  14. Query a single record source Using the Query Designer. 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 record source. For example, this type of query makes it easy to list your assets and their purchase dates. Create queries for a new database

  15. Query a single record source In the dialog box, select your record source. You can use a combination of tables and queries, and the ones you select appear in the upper section of the designer. Using the Query Designer. Here’s the process. On the Create tab, in the Queries group, click Query Design. The designer starts and displays the Show Table dialog box. On the ribbon, the Design tab also appears. Create queries for a new database

  16. Query a single record source Your record set appears as a datasheet. Using the Query Designer. In your record source, double-click the fields that you want to see in your record set, or results. Your choices appear in the bottom section of the designer. When you finish adding fields, go to the Design tab, and in the Results group, click Run. Create queries for a new database

  17. Make a query ask for input Using criteria in a query. 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; they are a type of filter that you build into your query. Create queries for a new database

  18. Make a query ask for input 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. Using criteria in a query. Here’s how to use parameters in your queries: Open the query in Design view, and in the Criteria row of the field you want to filter, enter your parameter. For example, you can use the criteria shown in the picture. Create queries for a new database

  19. Use a formula in a query Using a function 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. Create queries for a new database

  20. Use a formula in a query Using a function in a query. 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. When you run your query, the results include your calculation. Create queries for a new database

  21. Query multiple record sources Using the Query Wizard to build a multi-source query. You can use multiple tables, or other queries, as the record source for a new query. In fact, you’ll query multiple record sources far more than you will single sources. Multi-source queries are how you answer questions such as which assets came from which suppliers. The Query Wizard is the easiest way to get started building multi-source queries, especially if you’re new to Access. Create queries for a new database

  22. Query multiple record sources Using the Query Wizard to build a multi-source query. On the Create tab, in the Queries group, click Query Wizard. Complete the wizard. As part of that process, select the tables and fields you want to use as your record source, and… Give your new query a descriptive name, and remember to avoid using spaces in the name. Create queries for a new database

  23. Suggestions for practice • Create a select query from a single table. • Make the query ask for your input (add a parameter). • Add a calculated field to a query. • Format the calculated field. • Create a query from multiple tables. • Concatenate fields with an expression. Online practice (requires Access 2010) Create queries for a new database

  24. Test question 1 When you first create a query, you selectwhich of the following? (Pick one answer.) Create queries for a new database A record source. A system table. A record set.

  25. Test question 1 When you first create a query, you select which of the following? Answer: A record source. Create queries for a new database The record source can be a combination of tables and queries.

  26. Test question 2 Use criteria in a query when you need todo which of the following? (Pick one answer.) Create queries for a new database Ensure your data is properly formatted. Add formulas to a table. Sort, filter, or otherwise limit what the query returns.

  27. Test question 2 Use criteria in a query when you need to do which of the following? Answer: Sort, filter, or otherwise limit what the query returns. Create queries for a new database 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.

  28. Test question 3 Before you can use multiple tables as a record source, those tables must: (Pick one answer.) Create queries for a new database Be open in Datasheet view. Participate in a relationship. Not serve as the record source for another query.

  29. Test question 3 Before you can use multiple tables as a record source, those tables must: Answer: Participate in a relationship. Create queries for a new database 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.

  30. Test question 4 An expression is: (Pick one answer.) Create queries for a new database A formula stored in one or more database tables. A formula that just calculates dates. An object that can perform calculations and other tasks such as data validation.

  31. Test question 4 An expression is: Answer: An object that can perform calculations and other tasks such as data validation. Create queries for a new database This course has shown you a couple of ways to use expressions. The Quick Reference Card that’s linked to at the end points you to a lot more information about them.

  32. Test question 5 This course has taught you everything you need to know about queries. (Pick one answer.) Create queries for a new database True. False.

  33. Test question 5 This course has taught you everything you need to know about queries. Answer: False. Create queries for a new database The Quick Reference Card, linked to on the next slide, points to a lot more information. Grab it.

  34. Quick Reference Card For a summary of the tasks covered in this course, view the Quick Reference Card. Create queries for a new database

More Related