Insert or add a rich text field

In Microsoft Office Access 2007, you can store rich, formatted text in a database. You do this by using a memo field and setting the field's TextFormat property (new in Office Access 2007) to RichText. You can apply formatting to all or part of the contents of the field by editing the field through a bound control in a form, or when the field is displayed in a datasheet. You can also apply formatting to all of a field when viewing a report in Layout View (new in Office Access 2007).

This article explains how to insert or change a memo field that uses rich text, and how to format text by using rich text formatting options.

In this article


What is rich text?

Rich text is text that is formatted with common formatting options, such as bold and italics, that are unavailable with plain text. You format your data by using the formatting tools common to 2007 Microsoft Office system programs, such as Microsoft Office Word 2007 and Microsoft Office PowerPoint 2007. Behind the scenes, Office Access 2007 applies Hypertext Markup Language (HTML) formatting code to your data. Access uses HTML because it provides a greater degree of compatibility with rich-text fields stored in Windows SharePoint Services 3.0 lists.

The following table lists the rich text formatting options supported by Office Access 2007:

Icon Option Description
Button image Font name Selects a different typeface.
Button image Font size Selects a font size.
Button image Bold Makes the selected text bold. If the text is already bold, removes the bold.
Button image Italic Makes the selected text italic. If the text is already italic, removes the italic.
Button image Underline Makes the text underlined. If the text is already underlined, removes the underline.
Button image Align left Aligns the text against the left margin.
Button image Center Centers the text within the margin.
Button image Align right Aligns the text against the right margin.
Button image Numbering Begins numbering paragraphs. The number appears prior to each paragraph.
Button image Bullets Begins placing a bullet before each paragraph.
Button image Font color Selects a font foreground color.
Button image Text highlight color Makes text look like it was marked with a highlighter pen.
Button image Decrease indent Decreases the paragraph indentation.
Button image Increase indent Increases the paragraph indentation.
Left to right button image Left-to-right Fills control from left to right.
Right to left button image Right-to-left Fills control from right to left.

Office Access 2007 stores rich text by using the Memo data type. This is the only data type in Access that has built-in support for rich text. To create a field for storing rich text, you create a memo field and then set that field's TextFormat property to RichText.

Top of Page Top of Page

Introducing the TextFormat property

Most controls, fields, and objects in Access have an associated series of properties. A property is a named value that defines some characteristic of the object — such as its position, size, and whether or not it is visible. The TextFormat property holds the setting that determines whether the text is treated as rich text or plain text. The two possible values are:

TextFormat property Description
RichText The text is displayed as rich text and is stored and interpreted as rich HTML markup.
PlainText The text is displayed as plain text and is interpreted as plain text.

You set the TextFormat property for the memo field in table Design view. The value you set there is inherited by any text box you create to display the data in the memo field. The value is inherited only when you create the control, however. You can subsequently change the value by using the property sheet for the text box.

Top of Page Top of Page

Create a rich text field

You store rich text in a field that uses the Memo data type. This is the only data type that has built-in support for displaying and storing rich text. To create a field that can store rich text, you first create a memo field and then set the TextFormat property of the memo field to RichText.

Create a memo field to store rich text

  1. Click the Microsoft Office Button Button image, and then click Open.
  1. In the Open dialog box, open the database to which you want to add the field.
  2. In the Navigation Pane, right-click the table to which you want to add the rich text field, and then click Design View.
  3. In the table design grid, locate the first empty row. Then, in the Field Name column, type a field name.
  4. In the Data Type column, select Memo.
  5. Under Field Properties, click the General tab.
  6. Click inside theText Format box and select Rich Text.
  7. To save the table, click Save Button image. on the Quick Access Toolbar.

After you create the memo field, you can enter and format rich text in Datasheet view or in Form view. For information about formatting rich text, see the section Apply formatting options to text, later in this article.

Top of Page Top of Page

Change an existing plain text field to a rich text field

If you have an existing memo field that you would like to change so that it can store rich text, you can change the TextFormat property for that field from PlainText to RichText. If you have an existing text field that you want to change so that it can store rich text, you must first change the data type of the field from Text to Memo.

Change an existing memo field to store rich text

  1. Start Office Access 2007.
  2. Click the Microsoft Office Button Button image, and then click Open.
  1. In the Open dialog box, open the database that contains the field.
  2. In the Navigation Pane, right-click the table that contains the field, and then click Design View.
  3. In the table design grid, click the memo field that you want to change to rich text.
  4. Under Field Properties, click the General tab.
  5. Click inside the Text Format box and select Rich Text.
  6. To save the table, click Save.

Change an existing text field so that it can store rich text

  1. Click the Microsoft Office Button Button image, and then click Open.
  1. In the Open dialog box, open the database that contains the field.
  2. In the Navigation Pane, right-click the table that contains the field, and then click Design View.
  3. In the table design grid, click the text field that you want to change to rich text.
  4. Under Data Type, change Text to Memo.
  5. Under Field Properties, click the General tab.
  6. Click inside the Text Format box and select Rich Text.
  7. To save the table, click Save.

After you have stored rich text in a memo field, you can display it in a form or report by using a text box control. The text box control has a TextFormat property that inherits its initial value from the TextFormat property of the memo field. However, you can change the TextFormat property on the text box control.

Top of Page Top of Page

Apply formatting options to text

When you edit a rich text field, whether in Datasheet view or in Form view, you can apply formatting options by using the commands on the Mini toolbar or in the Font and Font Alignment groups on the Home tab. First, you select the text that you want to format, then you apply the formatting options.

When you use the mouse to select text in a memo field that supports rich text, the Mini toolbar appears after you complete your selection and release the left mouse button. The Mini toolbar includes buttons for the most commonly used formatting options.

The mini toolbar

Suppose you want to add emphasis to some text by applying bold formatting to make it darker and heavier.

Apply formatting using the Mini toolbar

  1. Click and drag to select the text you want to format.

The Mini toolbar appears.

  1. Position your mouse pointer over the Mini toolbar to make it more visible, and click Bold Button image.

When the Mini toolbar appears, it reflects the formatting characteristics of the text you have selected. For example, if the text is already bold, the Bold button on the toolbar will appear highlighted.

You can also apply formatting options from the Home tab on the Ribbon, part of the Microsoft Office Fluent user interface. Let's suppose you want to apply the Italic formatting option.

Apply formatting by using the Office Fluent Ribbon

  1. Click and drag to select the text you want to format.
  2. On the Home tab, in the Font group, click Italic Button image.

 Tip   To quickly select a word, place the pointer on the word and double-click. To select the entire paragraph, click three times.

Top of Page Top of Page

Change a rich text field to a plain text field

You can change a rich text field to plain text and remove all formatting by changing the field's TextFormat property to Plain Text. When you change a field from rich text to plain text, Office Access 2007 prompts you with a warning that all formatting will be removed. After you have applied the change to plain text and the table has been saved, you cannot undo the change.

Change a rich text field to plain text

  1. Start Office Access 2007.
  2. Click the Microsoft Office Button Button image, and then click Open.
  1. In the Open dialog box, select and open the database that contains the field.
  2. In the Navigation Pane, right-click the table that contains the field, then click Design View.
  3. In the table design grid, click the Memo field that you want to change to rich text.
  4. Under Field Properties, click the General tab.
  5. Click in the TextFormat box and select Plain Text.
  6. To save the table, click Save.

Top of Page Top of Page

What to do when the TextFormat property gets out of sync

For rich text support to work correctly, you must set the TextFormat property on both the memo field and any text box control that displays the memo field. Typically, these TextFormat properties should be the same. For example, the TextFormat property for both the field and the control should be set to RichText if you want them to support rich formatted text. If you don't want rich text, the property for each should be set to PlainText. If the TextFormat property on the memo field is set to RichText and the TextFormat property on the text box is set to PlainText, you'll see the full rich text HTML in the text box in Form view and in Datasheet view.

Top of Page Top of Page

For more information

 
 
Applies to:
Access 2007