Data Management

How to work with rich text in Access 2007 and 2010

True rich text wasn't supported in Access 2003 (and earlier versions). Access 2007 and 2010 both support rich text and it's easy to implement.

In the .mdb versions of Access, working with rich text wasn't impossible, but it certainly wasn't easy. With some slick VBA code or a third-party control you could get it, but it was a lot of work. Access 2007 and 2010 now support easy-to-implement rich text formatting, but only in memo fields.

Rich text means formatted text, but a bit more. Specifically, earlier versions don't allow you to single out a specific word or character within an entry for different formatting. It was all or nothing. Behind the scenes, Access is actually using HTML - something that probably won't matter to most users, but might matter to SharePoint and database developers and anyone upgrading an .mdb database to the .accdb format. Using Access 2010, let's take a quick look at how to apply the rich text setting:

  1. Add a memo field to a table.
  2. In the Field Properties pane, choose Rich Text from the Text Format properties dropdown list.
  3. Save the table.

The Text Format property is new and Plain Text is the default setting. A bound control will inherit this property. If you change the property at the table level, the bound control will not update accordingly. You must change that control manually. Once you switch back to plain text, the control will display text and HTML tags for existing entries. Implementing the new support for rich text couldn't be simpler. Simply enter the text and format it as you would in Word. For example, after entering text in the bound text box control, select a few characters or words. Then, using the available options in the Text Formatting group, format away! The entry below contains italics and bold. When upgrading an .mdb version database that uses a third-party rich text control or VBA code to support rich text, you might run into a snag. As I mentioned, the rich text support is HTML, not Rich Text Format (RTF). Trying to display previously stored RTF encoded text in the new rich text control won't work. If you must convert, you'll have to reapply the HTML tags.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

6 comments
irfanfazli
irfanfazli

Yes, I am storing rich text in the OLE field.

irfanfazli
irfanfazli

This post attracted me to as yet unsolved problem for me posted earlier ( pl. refer at http://www.techrepublic.com/forum/discussions/102-341216-3417964) I am using Access 2002 sp3. If what I intend to do cannot be achieved until Access 2007 as mentioned in this post, can I continue to use OLE field or do I have to switch to 'Memo'. How-to's are invited if simple update does not work. My problem relates to a question-bank where the questions are word text pasted manually (tough job) from word doc to records in Access table's OLE field. Thanks, IRFAN.

djcutler
djcutler

@m5ernel: Yes, it does - but you have to change the property of the associated text box in your form as well. Go to the data tab on the property sheet for the text box and there's a text format choice now. The MS Word formatting keyboard shortcuts work, too (e.g. Ctrl-B = bold).

djcutler
djcutler

Thanks! I have only recently changed from 2003 to 2010 and didn't know that was there!

m5ernel
m5ernel

It doesn't work for linked tables does it?

ssharkins
ssharkins

You can get rich text in 2003, but it isn't built in -- you can use a third-party control or use VBA code. You're currently using an OLE field to store rich text?