A query is a question formed in a manner that Access can interpret. The question that is asked may be simple or complex. For example, you might want to ask, "Which students are in the Culinary Arts Club?" Unless a query has already been set up to ask this question, you must create a new one. A query that retrieves data from one or more tables and then displays the results is called a select query.
When it comes to answering questions, queries offer more flexibility than filters because you can limit the fields that are included in the results, use more than one table, include calculated values, and save the query for future use.
In the following activity, you will create a simple select query and practice adding fields to the Select Query window.
With your 2A_Club Fundraiser database open, on the Objects bar, click Queries.
To the right of the Objects bar, double-click the command Create query in Design view, and then compare your screen with Figure 2.7.
A new Select Query window opens and the Show Table dialog box displays. The Show Table dialog box lists all of the tables in the database. If this dialog box does not display, on the Query Design toolbar, click the Show Table button. In this chapter, you will create queries in Design view.
In the Show Table dialog box, click Pledges, click the Add button, and then Close the Show Table dialog box. Alternatively, you can double-click Pledges and then click Close. Compare your screen with Figure 2.8.
If necessary, Maximize the Select Query window. Point to the border that separates the table area and design grid until the vertical resize pointer displays, and then drag downward to increase the size of the table area. Compare your screen with Figure 2.9.
In the table area, use the pointer to extend the lower edge of the Pledges field list to display all the field names.
In the Pledges field list, double-click Student#, and then look at the design grid.
In the Pledges field list, point to Club Affiliation, drag it downward into the design gridto the Field row in the next available column, and then compare your screen with Figure 2.10.
In the Field row of the design grid, click in the third column, and then click the list arrow that displays. From the displayed list, click Donor Last Name to add this field to the design grid, which is another way to add a field to the design of the query.
Using one of the methods you just practiced, add the Pledge Amount to the design grid. Compare your screen with Figure 2.11.
After you create a query, you run it to see the results. When you run a query, Access looks at the records in the table (or tables) you have included in the query, finds the records that match the specified conditions (if any), and displays those records in a datasheet view. Only the fields that have been included in the query design are displayed in the results. The query is always run against current data, and therefore presents the most up-to-date data.
On the Query Design toolbar, click the Run button . Alternatively, click the View button to display the results of a query. Compare your screen with Figure 2.12.
The results of the query display in Datasheet view. The four fields display in columns, the records display in rows, and navigation buttons display at the bottom of the window, in the same manner as in a table. Because no limitations or restrictions were placed on the data, the query results include all 30 records that are in the tablebut display only the fields you designated in your query design.
At the far right end of the menu bar, click the Close Window button .
In the Save As dialog box, in the Query Name box, using your own name type 2A Query1 Firstname Lastname and click OK, or press . Compare your screen with Figure 2.13.
The query is saved and closed. The new query name displays in the Database window on the Queries list. When you save a query, only the design of the query is saved. Each time you open the query, Access runs it again and displays the results based on the data stored in the underlying table(s). Thus, the results of a query always reflect the latest information in the underlying tables.
Chapter One. Creating Documents with Microsoft Word 2003
Chapter Two. Formatting and Organizing Text
Chapter Three. Using Graphics and Tables
Chapter Four. Using Special Document Formats, Columns, and Mail Merge
Chapter One. Creating a Worksheet and Charting Data
Chapter Two. Designing Effective Worksheets
Chapter Three. Using Functions and Data Tables
Chapter One. Getting Started with Access Databases and Tables
Chapter Two. Sort, Filter, and Query a Database
Chapter Three. Forms and Reports
Chapter One. Getting Started with PowerPoint 2003
Chapter Two. Creating a Presentation
Chapter Three. Formatting a Presentation
Chapter One. Using Access Data with Other Office Applications
Chapter Two. Using Tables in Word and Excel
Chapter Three. Using Excel as a Data Source in a Mail Merge
Chapter Four. Linking Data in Office Documents
Chapter Five. Creating Presentation Content from Office Documents
GO! with Microsoft Office 2003 Brief (2nd Edition)
Lean Six Sigma for Service : How to Use Lean Speed and Six Sigma Quality to Improve Services and Transactions