Microsoft Office Tutorials and References

In Depth Information

**Chapter 4: Doing Calculations in Forms and Subforms (and Reports)**

Chapter 4: Doing Calculations

in Forms and Subforms

(and Reports)

In This Chapter

✓
Including calculated results on your forms and reports

✓
Using numbers in calculations

✓
Using dates in calculations

✓
Using strings — that is, text — in calculations

✓
Using split forms to display a datasheet on a form

✓
Adding subforms to a form

✓
Totaling and counting information from subforms and subreports

The first three chapters of Book IV explain how to make forms with

all kinds of controls, showing information in all kinds of ways. In the

process, you find out how to create reports, because creating and editing

reports is so similar to working with forms. Up to this point, all the

information you’ve dealt with is sitting there waiting for you, nicely contained in

tables and queries. How about calculating data that isn’t stored anywhere?

Your forms and reports can calculate and display information that you can

also store in the record source for the form (that is, store the results so you

can use them in other objects). You may want the Order form for an online

store, for example, to calculate the total price of all items ordered, the sales

tax, and the grand total for the order.

In addition to calculating numbers, you can perform text, date, and logical

calculations, giving Access instructions such as “If Tax Exempt is True,

Sales Tax is 0; otherwise, it’s Tax Rate times Product Total.” Text

calculations include things such as keeping only the first five digits of a zip

code or capitalizing a text entry.

Doing Elementary Calculations

The title of this section sounds like algebra class, doesn’t it? Don’t worry;

creating calculated values for your forms won’t cause you to scream in

terror, the way your high school algebra teacher did. You’ll recognize some

arithmetic signs (especially the equal sign), but all the calculations are easy.