Microsoft KB Archive/121411

{| = How to Suppress Blank Fields in a Text Merge =
 * width="100%"|

ID: Q121411

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
 * Microsoft FoxPro for Macintosh, versions 2.5x, 2.6a

SUMMARY
You can suppress blank fields in a FoxPro text merge by programmatically creating the TEXTMERGE command and then using macro substitution to execute the command, as shown in the example below.

MORE INFORMATION
This example assumes that you have a table with three fields

NAME ADDRESS1 ADDRESS2 and that you want to perform a text merge that produces output in the following format:    

 If the ADDRESS2 field is empty, you want the date to appear directly underneath ADDRESS1, with no blank line where ADDRESS2 would normally appear. The following program illustrates how to create the desired output.

USE SET TEXTMERGE TO outfile.txt SET TEXTMERGE ON  SCAN * Test the ADDRESS2 field and return the appropriate text merge * character. cmnd=IIF(EMPTY(address2),"\\","\< >") \< >     \< >      * Use macro substitution to execute the command. &cmnd \<> \     \body of letter goes here * Print two empty lines between records. \     \   ENDSCAN SET TEXTMERGE OFF SET TEXTMERGE TO