Although you can overdo a good thing, a meaningful graphic or two can help readers quickly glean a report or a record’s meaning. For instance, the small triangle in the report header is a clear indication that second quarter sales are up from the first quarter. (A quick glance at the totals confirms this.) The graphic is the result of an Iif() function and a wingding (font).
If using Access 2010, turn off Layout Review as follows, before adding the graphic:
- Open the report (Northwind’s Yearly Sales Report), in Design view.
- Right-click the Q2 label. Or, select all of the controls in the Page Header section, by clicking the vertical ruler just to the left of the Page Header section. You’ll probably find it easier if you remove Layout Review from all of the controls.
- Choose Layout from the resulting context menu.
- Then, select Remove Layout.
To add the graphic, do the following:
- With the report in Design view, position a label-less text box over the right portion of the Q2 header label.
- Double-click the new control to open its property sheet.
- Name the new text box txtIcon. (You can skip this step, but it’s a good idea to name custom controls.)
- Enter the following expression as its Control Source: =IIf([txtQ2Total]>[txtQ1Total],”p”,”q”).
- With the control still selected, choose Wingdings 3 from the Font dropdown in the Font group (on the contextual Format tab).
Two things need a bit more explanation. First, the expression compares two values, txtQ1Total and txtQ2Total. These controls, in the report’s footer, return the total for the first and second quarters, respectively. If the second quarter sales are greater than the first quarter sales, the expression returns the letter p. If the condition is false, the expression returns q.
That brings us to the second explanation: the Wingdings 3 font displays an up-facing triangle and a down-facing triangle, instead of the letters p and q, respectively. I’ve only added one graphic to the report, but you could add one to each label, updating the expression to reflect the appropriate quarters.