Else
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End If
End Sub
Form Field Documents........................................................................................................
Sometimes you need to create documents that display some data from Access and also allow users
to enter more data in a controlled fashion. This can be done using either bookmarks or doc prop-
erties to display the Access data, and Word content controls (called form fields in earlier versions of
Word) for the user-entered data.
The third button on frmContacts creates a letter filled with data from Access, using doc properties;
additionally, the template has two form fields, to be filled in by the user when creating the docu-
ment. Of course, users can just type text into a document, but form fields allow the developer to
limit the information to a selection of appropriate values, perhaps in a protected document section
that does not allow free-form entry.
To insert a content control into a template, select the control type from the Controls group on the
Developer tab of the Ribbon, as shown in Figure 2.13.
FIGURE 2.13
Inserting a dropdown-type content control.
If you don’t see the Developer tab, turn it on by checking the “Show Developer tab in the
Ribbon” checkbox on the Personalize page of the Word Options dialog (Figure 2.14).
To add the choices for a drop-down or combo box list, switch to Design mode by clicking the
Design button in the Controls group, select the control, and then select Properties from the
Controls group on the Developer tab, as depicted in Figure 2.15.
TIPTIP
Creating Word Documents from Access 2