Microsoft KB Archive/113177

{|
 * width="100%"|

How to Use FoxPro Data in an MS Word for Mac Print Merge

 * }

Q113177

-

The information in this article applies to:


 * Microsoft Visual FoxPro for Macintosh, version 3.0b
 * Microsoft FoxPro for Macintosh, version 2.5b

-

SUMMARY
In order to use a FoxPro for Macintosh database file in a Microsoft Word version 5.1 for Macintosh print merge, the database file must be copied to a text file and then modified in Word.

MORE INFORMATION
Microsoft Word for Macintosh cannot use a .DBF format file in a print merge. The following changes need to be made to the data in order for the print merge to work.

NOTE: The following steps are for use with Word 5.1 for Macintosh. For other versions of Word, modify them accordingly.

 In FoxPro, USE the database.  In the Command window, issue one of the following commands in order to copy the database to a text file:     COPY TO test.txt TYPE DELIMITED WITH TAB -or-     COPY TO test.txt TYPE DELIMITED NOTE: Other clauses of the COPY TO command, such as FIELDS and FOR, can be used to limit the number of records or fields copied to the text file. A scope clause (such as ALL, NEXT, RECORD, or REST) can also be used.  In Word, open the text file TEST.TXT. Make sure you open the file in Text format, not Text With Layout format. Insert a new line at the top of the text file, and then type field names, one for each field in the database copied to the text file. Separate the field names with tabs if the TYPE DELIMITED WITH TAB clause was used in the COPY TO command. Use commas if the TYPE DELIMITED clause was used. Select (highlight) one of the hollow box characters that appear at the end of each record in the text file. Copy this character to the Clipboard by choosing Copy from the Edit menu or by pressing COMMAND+C. Move the insertion point (the flashing bar) to the beginning of the text file. From the Edit menu, choose Replace, or press COMMAND+H.

The Replace dialog box will appear. In the Find What box, press COMMAND+V to paste in the hollow box character that you copied in step 5. In the Replace With box, type ^p, or choose Paragraph Mark from the Special list box.</li> Choose the Replace All button. Once all the hollow box characters have been replaced with paragraph marks, the text file can be used as a data file for a print merge.</li></ol>

Two Word error messages that you may encounter are listed below:


 * The "Duplicate Field name in data document" error message can occur if the field names referred to in step 4 above are not entered, and there is duplicate data in the file. State abbreviations commonly cause this error.
 * The "Data record too long" error message can occur if the hollow box characters are not replaced with paragraph marks. Word does not recognize the character that FoxPro puts at the end of each line as the end of a data record.