Microsoft Office Tutorials and References
In Depth Information
5. Click the OK button. Access closes the Expression Builder dialog box and adds the expres-
sion to the design grid in the Field text box for the calculated field.
Next, you need to specify a name for the calculated field as it will appear in the query results.
6. Press the Home key to position the insertion point to the left of the expression.
You’ll enter the name WeeklyBonus, which is descriptive of the field’s contents; then you’ll
run the query.
7. Type WeeklyBonus: . Make sure you include the colon following the field name. The colon is
needed to separate the field name from its expression.
8. Run the query. Access displays the query datasheet, which contains the three specified
fields and the calculated field with the name “WeeklyBonus.” Resize all datasheet columns
to their best fit. See Figure 3-35.
Datasheet displaying the calculated field
speci f ied name for
the calculated field
calcu l ated
Trouble? If the calculated field name does not appear correctly, as shown in Figure 3-35,
you might not have included the required colon. Switch to Design view, then repeat Steps 7
and 8, making sure that you type the colon following the field name, to separate it from the
calculated field’s expression.
Notice the WeeklyBonus value for Ski & Stay; the value appears with three decimal
places (9.375). Currency values should have only two decimal places, so you need to for-
mat the WeeklyBonus calculated field so that all values appear in the Fixed format with
two decimal places. You’ll also set the Caption property for the calculated field so that it is
displayed in the same way as other field names, with a space between words.
To format the calculated field:
1. Switch to Design view.
2. Right-click the WeeklyBonus calculated field in the design grid to open the shortcut menu,
and then click Properties . The property sheet for the selected field opens. The property
sheet for a field provides options for changing the display of field values in the datasheet.