Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.
With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.
Learn more about Allen...
Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Merging Formatted Data.
Volker described a situation that he was having when merging data from an Access database. In the database he uses a mask for the phone number field, such as !(999) 000-0000;;_. When he merges the phone number into the Word document, the formatting symbols (the dashes and parentheses) are not in the merged data, so the phone numbers look strange.
If you have control over the Access database, perhaps the simplest solution is to change how the data is actually stored in your Access data table. When you define your phone number field in Access, specify that the mask characters be saved with the data in the phone number field. (Access allows you to either save the mask characters or not.) If you choose to store without them, you'll save space in your data table. If you choose to store with them, then they are available for export to programs such as Word.
If you have no control over the Access database, then making changes to how data is stored is probably not an option for you. In that case you may need to play with the merge fields used by Word. If the data is stored in the Access table as a number, then you can add a mask to the MERGEFIELD field within your Word merge document. Some good tips for how to do that can be found at either of the following locations:
Remember that using masks in this manner will only work if your phone number is stored in Access as a numeric value. Based on the fact that you are using a mask for the Access field, that tells me that your phone number is stored as text. (Masks are available only for date and text fields in Access, not for numeric fields.) The only recourse in that case is to actually modify how information is stored in the Access table.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (143) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Merging Formatted Data.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!