Friday, February 16, 2018

Enter or edit data in a control or column that supports rich text

Enter or edit data in a control or column that supports rich text

You can enter, edit, and format data in a memo field in a Microsoft Office Access 2007 database. Although memo fields are not new to Access, you can now apply rich text formatting to the text that they contain. Rich text formatting provides the types of formatting available in other 2007 Microsoft Office system programs, such as Microsoft Office Word 2007 and Microsoft Office PowerPoint 2007. For example, you can make the text bold or underlined, you can apply different fonts to individual words or characters, and you can change text colors.

What do you want to do?

Understand rich text formatting

Enable rich text editing in a table

Add text to a memo field

Apply rich text formatting to memo data

Enable rich text formatting for controls in forms and reports

Enable rich text editing manually

Understand rich text formatting

In Office Access 2007, you can set a memo field to support rich text formatting. You can then apply rich text formatting to memo data in tables and query result sets, and also to the data in any text boxes in forms and reports that you bind to the memo fields in your tables.

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 in Windows SharePoint Services 3.0 lists.

Access Ribbon Image

Top of Page

Enable rich text editing in a table

You can enable rich text editing only for table fields set to the Memo data type in Office Access 2007 database tables. After you add a memo field to a table, you enable rich text formatting by setting the Text Format property for the field. The following steps explain how to add a Memo field to a table, enable rich text formatting for that field, and then apply formatting to part or all of a record. These steps apply to databases created in the Office Access 2007 format and also to databases created in earlier versions of Access (.mdb files) that you open in or convert to the Office Access 2007 format. Note that these steps do not apply to projects (.adp files) or to data access pages.

Note: When you attempt to enable rich-text editing for an existing table, you might find that the table has the Append Only property enabled. To enable rich text formatting for a field, you must ensure that the Append Only property for the table is disabled. Otherwise, Access hides the text in the field whenever you place your cursor in that field, or in any form controls bound to that field.

Show me how to disable the Append Only property

  1. In the Navigation Pane, right-click the table that you want to change and click Design View on the shortcut menu.

  2. Select the Memo field that you want to change, and in the lower part of the table designer, on the General tab, scroll down to the Append Only property.

  3. Click the field next to the property and select No from the list.

Add a memo field in Datasheet view

  1. In the Navigation Pane, double-click the table that you want to change. This opens the table in Datasheet view.

  2. Select a blank field (the colored cell that reads Add New Field). The following figure shows a blank field:

    A new field in a datasheet

  3. Double click the field header and enter a name for the new field.

  4. On the Datasheet tab, in the Data Type & Formatting group, click the down arrow next to Data Type (the list at the top of the group), and select Memo.

Add a memo field in Design view

  1. In the Navigation Pane, right-click the table that you want to change and click Design View on the shortcut menu.

  2. In the Field Name column, enter a name for your new field.

  3. In the Data Type column, click the cell for that row and then select Memo from the list.

  4. Save your changes.

Enable rich text editing for a memo field

Note: There are no commands available on the Ribbon, which is part of the Microsoft Office Fluent user interface, to enable rich text editing for a Memo field.

  1. In the Navigation Pane, right-click the table that you want to change and click Design View on the shortcut menu.

  2. In the lower section of the table design grid, under Field Properties, and then click the General tab.

  3. Click the list next to the Text Format property box, and then click Rich Text.

  4. Save the table Button image .

  5. Switch to Datasheet view Button image and follow the steps in the next section to enter some data in the field.

Top of Page

Add text to a memo field

Adding text to a memo field is much like adding text in any word processing program — you place a cursor in the table field or text box and begin typing. Other text operations, such as copying, cutting, and pasting, also use common controls. The steps in this section explain how to enter text and perform common operations.

Enter text in a memo field in a table

  1. In the Navigation Pane, double-click the table that contains the memo field. This opens the table in Datasheet view.

  2. Click the memo field, click again to place your cursor, and then type your text.

    How do I know whether I'm looking at a memo field?

    1. With a table open in Datasheet view, click the Datasheet tab.

    2. Move the pointer from field to field (use your mouse, the TAB key, or the Left and Right arrow keys), and in the Data Type & Formatting group, note the data type that appears in the Data Type list at the top of the group.

  3. Enter, change, or format the text as needed. For information about formatting, see the section Apply rich text formatting to memo data, later in this article.

  4. To commit your changes to the database, position the pointer in another table field.

    Keyboard shortcut  SHIFT+ENTER.

    –or–

    On the Home tab, in the Records group, click Save.

    Access Ribbon Image

Enter text in a form

  1. In the Navigation Pane, double-click the form that you want to use. This opens the form in Form view.

  2. Place the cursor in the text control and then type, change, or format the text as needed. For information about formatting, see Apply rich text formatting to memo data, later in this article.

  3. To commit your changes to the database, on the Home tab, in the Records group, click Save Record. Alternatively, you can press SHIFT+ENTER.

Copy, cut, and paste text in a table or form

  1. Highlight the text that you want to copy or cut.

  2. On the Home tab, in the Clipboard group, click either Copy Button image or Cut Button image . Alternatively, you can press CTRL+C to copy or press CTRL+X to cut.

  3. Paste the text into any logical location, such as a memo field in another table or form, a Word document, a Microsoft Office Excel 2007 worksheet, an e-mail message, or another location in your text box. Then, click Paste Button image . Alternatively, you can press CTRL+V to paste.

Top of Page

Apply rich text formatting to memo data

If you have used other Office programs, you probably have some experience formatting data. The formatting tools in Access work like the tools in other programs. For example, Access uses the standard buttons for formatting and aligning text, and for formatting rich text. This figure shows the formatting commands:

Access Ribbon Image

This figure shows commands for formatting rich text:

Access Ribbon Image

You can use these formatting commands on forms open in Form view, and you can use a smaller set of the commands on forms open in Layout view. However, when you apply a format to a memo field in Layout view, the formatting you apply affects all of the text in the field because you are applying a format to the control, not to the text. You cannot format individual characters or blocks of text when you work in Layout view. The following list contains examples of how you can apply formatting to some objects that are open in various views.

  • Forms open in Form view    You can apply formatting to part or all of the text in a memo field. The formatting commands appear in the Font and Rich Text groups of the Home tab, and in the Mini toolbar that appears whenever you highlight part or all of the text in the field.

  • Forms open in Layout view    You can use a smaller number of the commands, and your changes apply to the text box that displays the data. Any text that appears in that control then assumes the new format. You can apply different formats to the text, but you cannot undo the format applied to the control. For example, if you set the text box to display text in italics, you can make the text bold or change its color, but the control always displays your text in italics. If you try to remove the italics, you can do so while the record is open. However, Access removes your changes when you navigate away from the record. You cannot format individual letters or blocks of text while working in Layout view.

  • Tables or query result sets open in Datasheet view    The formatting commands appear in the Font and Rich Text sections of the Home tab, and in the Mini toolbar that appears whenever you highlight part or all of the text in the field.

  • Reports open in Layout view    Like forms open in Layout view, Office Access 2007 provides a smaller number of commands, and any changes you make apply to the entire memo field. You cannot format individual letters or blocks of text while working on a report in Layout view.

If you are new to using formatting, the following table lists the commands in the Font group and describes how to use them. Remember that the commands that you see in the various groups on the Office Fluent Ribbon can change, depending on the view that you use.

Formatting Command

Name

Use

Button image

Font

Select a font. By default, Office Access 2007 uses 11-point Calibri, a font that ships with 2007 Microsoft Office system.

Button image

Font Size

Select a size for a font.

Button image

Align Left

Aligns data to the left side of the control. When you format a label, this command aligns the text to the left side of the text region.

Button image

Center

Centers data in the control. When you format a label, this command centers the text in the text region.

Button image

Align Right

Aligns data to the right side of the control. When you format a label, this command aligns the text to the right side of the text region.

Button image

Bold

Makes text in controls and labels bold.

Button image

Italic

Italicizes text in controls and labels.

Button image

Underline

Underlines text in controls and labels.

Button image

Font Color

Changes the color of a font.

Button image

Fill Color

Applies a color to the background of the control and the text region of the label associated with the control.

Button image

Gridlines

Opens the Gridlines gallery. Selecting a grid style applies that style to the open datasheet.

Button image

Alternate Fill/Back Color

Sets the background fill color for the alternate rows in a datasheet or report.

This table lists and describes the formatting controls available in the Rich Text group on the Home tab. As you proceed, remember that Access does not enable these controls until you enable rich text editing for a Memo field.

Formatting Command

Name

Use

Button image

Increase Indent

Increases the indent of data in the selected field or control by 0.25 inches or 360 twips. This is a default increment that you cannot change.

Note: This command is not available in Design view.

Button image

Decrease Indent

Decreases the indent of data in the selected field or control by 0.25 inches or 360 twips. This is a default decrement that you cannot change.

Note: This command is not available in Design view.

Button image

Left-to-Right or Right-to-Left

Controls whether text fills a field from the left or right sides. For left-to-right languages, Access fills text fields from left to right and number fields from right to left by default. For right-to-left languages, Access does just the opposite. Click this command if you want to change the default behavior for either type of language.

Note: This command is not available in Design view.

Button image

Numbering

Creates a numbered list. This command works only on text in a Memo field. You can use the command in tables open in Datasheet view, and in forms open in Form view.

Button image

Bullets

Creates a bulleted list in your text. This command works only on text in a Memo field. You can use the command in tables open in Datasheet view, and in forms open in Form view.

Button image

Text Highlight

Surrounds your text with a highlight color. Select some or all of the text in the field, click the button to open a color palette, and then select a color.

Format data

  1. Select the text that you want to format.

  2. On the Home tab, in either the Font or Rich Text group, click a formatting command.

    You can select a different font, make the text bold, apply a color to the selected text, change your text alignment, and so on.

    To save your changes, place the cursor in another record. Alternatively, you can click Save Record Button image or press SHIFT+ENTER.

Top of Page

Enable rich text formatting for controls in forms and reports

As a rule, you need to enable rich text editing only when you add a text box to a form or report manually. If you use the commands on the Create tab to create a form or report, and you have enabled rich-text editing for the underlying memo field, the resulting text box control inherits the Text Format property set for the memo field.

These steps explain how to create a form that automatically enables rich text formatting for a control. To follow the steps, you must be working in an Office Access 2007 database, and you must have a table that contains a memo field.

Enable rich-text formatting

  1. Open the table that contains your memo field. You can open the table in Datasheet view or Design view. Access uses the open table as the basis for your new form.

  2. On the Create tab, in the Forms group, click Form, Split Form, or Multiple Items.

    Office Access 2007 creates a new form, places a control on the form for each table field, and binds the controls to the open table. The types of controls that Office Access 2007 places on the form depend on and correspond to the data types set for each table field. Because your table contains a memo field, Office Access 2007 places a text box control on your form and binds the control to the field. Because you enabled rich text formatting for the field, Office Access 2007 automatically enables that formatting for the control. If you have data in the memo field of your table, that data appears in the text control on your form.

  3. Switch to Form view, and highlight part or all of the text in a record.

  4. On the Home tab, use the commands in either the Font group or the Rich Text group to format the text.

    You use the commands in the Font group to set text in bold, italic, or underlined, to change the color of the text, and to align text to the left, center, or right side of the control. You use the commands in the Rich Text group to apply bulleted or numbered formatting, highlight text, and to add indents and paragraph breaks.

Top of Page

Enable rich text editing manually

By default, Office Access 2007 does not enable rich text editing when you add a control to a form manually, even if you bind that control to a memo field. These steps explain how to add a control to a form, bind the control to a memo field, and then enable rich text editing. To complete these steps, you must use an Office Access 2007 database, and a table must contain a field set to the memo data type. For information about adding a memo field to a table, see Enable rich text editing in a table, earlier in this article.

Add the control to the form

  1. In the Navigation Pane, right-click the form that you want to change and click Design View on the shortcut menu.

  2. On the Design tab, in the Controls group, click Text Box.

  3. In a blank area of your form, click and drag your mouse to draw the control.

    By default, Office Access 2007 creates a label and associates that label with the new control.

  4. Click the text area of the new control, right-click the text area of the control (not the label), and then click Properties.

    The Property Sheet pane for the control appears.

Use the following procedure to bind the control to a memo field.

Bind the control to a memo field

  1. In the property sheet for the new control, click the All tab.

  2. Click the Control Source property box and select your memo field from the list.

    By default, the list shows the fields in the table that is bound to your form. If your memo field resides in another table, use this expression syntax to bind the control: =[table name]![field name]. Use the brackets and exclamation point exactly as shown. Type the name of your table in the first part of the expression, and the name of your memo field in the second part. For example, if you have a table named Notes with a memo field named Compliments, you would enter this string in the Control Source property box: =[Notes]![Compliments]

Use the following procedure to enable rich text editing.

Enable rich text editing

  1. In the property sheet, with the All tab still selected, locate and select the Text Format property box, and then select Rich Text from the list.

  2. Save your work Button image .

Top of Page

1 comment:

  1. Thank you very much for sharing this awesome information about Rich Text Edit Control. Thank you for sharing.

    ReplyDelete