Wrap text in Access

How do you wrap text in Access? It's a question we hear quite frequently on Office.com. It may surprise you to learn that in most places where text is displayed in Access, text wrapping is on by default. The key is making sure there is enough room for the text to wrap. The process for doing that depends on what kind of object you're working with.

In a datasheet

In a datasheet view, you need to manually adjust the row height before you can see the text that wraps to subsequent lines. The catch is that the new row height applies to all rows in the datasheet, so the datasheet takes up more vertical space and you wind up doing more scrolling to view all your records.

An Access datasheet showing manually-sized rows

In a report

On reports, you can set the CanGrow property of text boxes and report sections to Yes, which lets them adjust their heights automatically based on the amount of text they contain. This makes for a better presentation than a datasheet, because each row is set to the necessary height for that record. If you create a simple report by using the Report tool on the Create tab, you'll see the CanGrow property in action.

An Access report showing automatically-sized text boxes

In a form

You can also set the CanGrow property for a control on a form; however, the setting only takes effect when you print the form or view it in Print Preview. If the form is only to be viewed on the screen, you'll just need to design your form so that text boxes that are likely to contain lots of text are larger than the others. The text will wrap automatically, and scroll bars will appear by default when there is still too much text to display (unless, of course, you've turned scroll bars off in the Property Sheet).

Another tip for forms: check out the control "anchoring" feature, which was introduced in Access 2007 and is described in the video Make a text box grow or shrink as you resize a form. You can use this feature to make a text box automatically get wider or taller as you resize the form or the Access window. In Layout View or Design View, the Anchoring command is located on the Arrange tab.

The Anchoring command on the Arrange tab

Zoom

One other tip--if you just want to see the full contents of one field without doing any resizing, put the cursor in the field and then press SHIFT+F2 to open the Zoom dialog box.

The Zoom dialog box

Any text wrapping tips or tricks that I've overlooked? Leave a comment and let us know!

--Chris Downs

Office Blogs Comments

Comments: (4) Collapse

  • Chris ... thanks for that anchoring video. VERY cool!

    joe

  • Glad you liked it, Joe! It's a great feature. There's a related video about making a control move as you resize a form here: office.microsoft.com/.../watch-this-make-a-control-move-as-you-resize-a-form-HA010256539.aspx

    Chris

  • I second how wonderful the new anchoring stuff is.

    Anchoring really helps forms to work great on different sized monitors. Perhaps you add control docking for the future also? I already noticed that there are some nice improvements in a2010 that over 2007 for anchroing.

    I freely admit that anchoring is much something new to the general Access community and we not adopted anchoring as a general habit during design. However I do think over time anchoring of controls will become second nature to Access developers.

    I am not sure when the last time anchoring was reviewed on this blog, but this issue certainly could deserve a post/topic on this subject again.

    Albert D. Kallal  (Access MVP)

    Edmonton, Alberta Canada

  • Thanks for the comment, Albert! I'll pass along the control docking suggestion, and see if we can do another post on anchoring soon.

    --Chris

Comments

Comments: (loading) Collapse