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

Last reviewed: May 20, 1996
Article ID: 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.

  1. In FoxPro, USE the database.

  2. 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.

  3. In Word, open the text file TEST.TXT. Make sure you open the file in Text format, not Text With Layout format.

  4. 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.

  5. 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.

  6. 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.

  7. 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" (without the quotation marks), or choose Paragraph Mark from the Special list box.

  8. 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.

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.

REFERENCES

FoxPro for Macintosh "Language Reference," version 2.5, pages 270-275

For additional information, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q110539
   TITLE     : PRFOX: COPY TO DELIMITED Creates File with No Carriage
               Returns


Additional reference words: vFoxMac 3.00b FoxMac 2.50b printmerge errmsg
err msg macword
KBCategory: kbprg kberrmsg
KBSubcategory:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 20, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.