Part II Writing VBA Code to Exchange Data between Office Components
n Numeric fields should also be avoided, both because you can’t make them blank (you
may not want a zero appearing in your document when the field has no data from
Access), and, more importantly, because all numbers are truncated to integers. A value of
49.21 in Access will be truncated to 49 in the Word document property. As with Date val-
ues, it’s best to save numeric values to a Text document property (Text values are not
truncated), and then format them with the appropriate numeric format in Word.
n Yes/No properties require you to select either Yes or No as the default value; if that is
unacceptable, use a Text field, possibly converting the True or False values in an Access
Yes/No field to “Yes,” “No,” or a zero-length string (“”).
FIGURE 6.13
The Summary tab of the Word properties sheet.
Sometimes, in Word 2007, after delving down a few levels from the new Ribbon, you
will see a familiar Word 2003 dialog box. If you see a tiny diagonal arrow in the lower-
right corner of a group on a Ribbon, click the arrow, then the image of the dialog, to open the famil-
iar Word 2003 dialog box for that feature (see Figure 6.14).
Sending a Word Letter to a Single Access Contact
You may have a Contacts or Customers form in an Access database, and it would be convenient to
have a quick way to create a letter to the current contact, using a command button on the form.
The sample Word Export database has a form for browsing contacts, frmContacts, shown in
Figure 6.15.
If you click the Word button in this form’s header, a letter to the selected contact is created, filling
Word document properties with data from that record.