MS Access for the Business Environment: Create a Calculated Field with the Expression Builder - Page 4
June 5, 2003
The expression we have created in the Expression Box now appears as shown in Illustration 11.
26. Click OK.
The Select Query dialog appears as shown in Illustration 12.
The expression we have created is in place, although it may be compressed, as shown. We can always reopen the Expression Builder to review or edit the expression by right-clicking and selecting Build ... from the context menu, should the need arise.
27. Right-click the field containing the expression we have created.
28. Select Build... from the context menu that appears.
29. Carefully type the caption Net Price: over the existing Expr1:, changing nothing else in the expression.
The Expression Box should now appear as shown in Illustration 13.
30. Click OK.
31. Select View --> Datasheet View from the top menu.
(The Datasheet View icon at the left of the Access toolbar, just below the File menu item (as shown in Illustration 14) is an alternative means of achieving the same action.)
The view changes to display the results of the calculated field (Illustration 15) for the entire column. A quick check of the math indicates that the correct Net Price is reflected.
32. If desired, Select File --> Save as and save the query, with a meaningful name and location.
Our options abound at this point; we can convert the query to a Make Table query, or insert the calculation into an existing table or report in other ways. MS Access offers us a rich set of options in the creation and use of calculated fields.
With this tutorial article, Create a Calculated Field with the Expression Builder, we have begun the new MS Access for the Business Environment series. Our objective in this lesson was to introduce calculated fields in MS Access, focusing on the practical steps of their creation in a simple business scenario. We briefly explored the concept of calculated fields, introduced the MS Access Expression Builder as a straightforward means of creating and editing them, and provided a practical walkthrough of the process of creating a sample Net Price calculated field.