Builtin Word Export in Office

For many Office versions, it has been possible to export Access data to Word documents from the Access toolbar. The name of the control and toolbar location have changed over Office versions; in Access 2003 it was the OfficeLinks drop-down control on the Database toolbar, offering options to Merge to Word (Mail Merge), Publish to Word (RTF), or Analyze with Excel (XLS). In Access 2007, on the new Ribbon that replaces the old toolbars and menus, the External Data tab (shown in Figure 6.1) has an Export group with a variety of export options, including Excel, SharePoint, Word (RTF), Text File, and More. On the More drop-down menu, there are a number of export selections, including Merge It with Microsoft Office Word.

K^^Ysi^SHF w'" see different selections on the More menu (or selections appearing as enabled

3f irtiior disabled) according to the type of object selected in the Object Bar, and whether the object is open or closed. With a form open, for example, you will see the Access Database, XML File, and HTML Document selections (these selections are enabled) and a disabled selection, Merge It with Microsoft Office Word; the Snapshot Viewer selection is only enabled when a report is selected.

FIGURE 6.1

The new External Data tab on the Access 2007 Ribbon, with the More menu dropped down.

FIGURE 6.1

The Word (RTF) and Word Mail Merge features in Access 2007 work much the same as in earlier Office versions. If you select an Access table, query, or other object, and then select the Word (RTF) option, all the data from the entire selected object is automatically exported to a new Word document, with no option for selecting records.

The RTF document created from a table, query, or form is a Word table, which is a good match for data in an Access table or select query, but a very poor match for a form. Reports are created as text documents, not tables (even if they are tabular reports), with footers as text in the body of the document, and without most of their formatting; such a document is barely usable. (This is unchanged for many Office versions now.)

The RTF export option may be useful for creating a quick-and-dirty Word document you can send to someone who doesn't have Access, but it is not useful for creating letters or other formatted Word documents. Figure 6.2 shows an Access table to be exported, and Figure 6.3 shows the Export dialog, with two options enabled and one disabled (because the object being exported is a table, there is no formatting to export).

Figure 6.4 shows the Word table created by the RTF export. It has basically the same appearance as the Access table, but it lacks the alternate-row shading, even though Word 2007 supports this feature.

FIGURE 6.2

An Access table to be exported to Word.

FIGURE 6.2

An Access table to be exported to Word.

FIGURE 6.3

The Word RTF Export dialog when exporting an Access table.

FIGURE 6.3

The Word RTF Export dialog when exporting an Access table.

FIGURE 6.4

A Word document created by exporting an Access table, using the Word (RTF) option.

FIGURE 6.4

A Word document created by exporting an Access table, using the Word (RTF) option.

The Word Mail Merge option runs a wizard, which is generally similar to the one in the last two Office versions. It offers you a choice of deselecting some records from the data source before performing the merge, and you can create a new merge letter on the fly, so this interface choice can be useful when you need to create a set of minimally formatted Word letters to recipients from an Access table or query — but it may not be any easier to go through the six steps of the wizard, compared with just creating a simple Access letter report based on a filtered query.

My conclusion, after reviewing the new data export features in Access 2007, is that (just as with previous versions of Access) if you want to be able to select the records for an export of Access data to Word, and to produce great looking documents that can be opened and possibly edited by all Office users, you're still best off writing VBA code to merge Access data to Word documents.

The Word Export.accdb sample database contains the tables, queries, forms, and code used in this chapter.

0 0

Post a comment