Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 18: Advanced Access Query Techniques .......................................................................


639


Note
Because you are using only one table, the name of the table is not required before each field name in the QBE
grid. However, adding the table name in front of each field in the QBE grid is good practice to avoid issues in
queries involving multiple tables. You could have just as easily typed DiscountPrice: Price - Price *
DiscountPercent.



  1. Click the OK button in the Zoom box (or press Enter) to return to the Design window.

  2. Click the View button on the toolbar to see the new calculated field in the query results.


Your screen should look similar to Figure 18.2.


Figure 18.1 shows the expression from Step 5 being built in the Zoom window.
DiscountPrice is the calculated field name for the expression. The field name and
expression are separated by a colon.


FIGURE 18.2
The recordset containing the calculated DiscountPrice

Save this query to use later, naming it qrySalesTotalsWithTax.


Note
You don’t have to use the Zoom box to compose the expression defining a calculated field. You can just as eas-
ily type the expression directly into a Field cell in the QBE grid. However, many Access developers prefer using
the Zoom box because expressions are sometimes quite long and complicated. The Zoom box makes it easy to
see the entire expression without having to scroll through a Field cell in the QBE grid.

Free download pdf