Displaying Empty or Long Fields
Text and Memo fields can pose problems on reports, because they can contain one or hundreds of characters. Anticipating how much space to leave for them is hard. Luckily, Access has some features to help deal with long fields.
Displaying long text
If a Text or Memo field in your report contains more than a few words, you may want the field to wrap onto additional lines. For example, the Description field in a Products table may contain a whole paragraph about the product. You could display the field in a very large text box control that can fit the largest description in the table, but Access would leave a large empty space in the report after short descriptions. Instead, each text box can expand or shrink vertically to fit the amount of text in the field for each record.
To make a text box grow, start off by making it big enough to fit just one line of text. Display its Property sheet by clicking the Property Sheet button on the Tools group of the Design tab on the Ribbon. Then set its Can Grow property (which is on the Format tab) to Yes. When Access prints each record, the textbox control expands until the entire value of the field fits. The remaining controls move down the page.
When you set a control's Can Grow property to Yes, Access sets the Can Grow property for the section that contains the property, too. When Access prints the report, the section expands as well as the control, so nothing gets cut off. If you don't want the section to expand, you can change its Can Grow property back to No to omit information that doesn't fit in the section. Set the Can Grow property to No when printing on forms of a predetermined size, such as mailing labels. (Later in this tutorial, we show you how to set up a report that prints mailing labels.)
Displaying Fields That May Be Empty
To avoid leaving blank lines when a field is blank, set the Can Shrink property for the text box to Yes. (This setting is on the Format tab of the Property sheet.) For example, many address lists are stored in tables that have two lines for the street address. If the second line is empty, the mailing label looks better if the city/state/zip line prints right below the first address line with no gap.
To make a textbox control that shrinks when the value is blank, make the text box big enough to fit the longest value in the table. Then set its Can Shrink property to Yes. When printing the report, Access omits the control if the field value is blank.
When you set the Can Shrink property of a control to the Yes setting, Access does not automatically change the Can Shrink property of the section that contains the control. Leave the Can Shrink properties of the Detail section set to the No setting if the Detail section must always be the same size - as with mailing labels or other pre-printed forms. Otherwise, set these properties to Yes.
In this tutorial:
- Creating and Editing Reports
- What are Forms and Reports
- Creating Reports Automatically
- Running the Report Wizard
- Creating Simple Reports
- Editing Reports in Design View
- Adding page headers, footers, and numbers
- Adding sections that group your records
- Sorting the records in your report
- Calculating group subtotals and report totals
- Formatting Tips and Tricks
- Copying Forms to Reports
- Adding and Formatting Subreports
- Displaying Empty or Long Fields
- Creating Mailing Labels