Microsoft KB Archive/38875

From BetaArchive Wiki

Using IF, ENDIF, ELSE, Nested IF Instructions in Print Merge

PSS ID Number: Q38875 Article last modified on 11-02-1994

3.x 4.00 5.00

MS-DOS

SUMMARY

The IF instruction is a conditional instruction that you can use to instruct Word to print specific text if a condition is met. The IF instruction must end with an ENDIF. You can also use the ELSE clause to tell Word what to print if the condition is not met.

The IF instruction can also be nested, as long as each IF is matched with an ending ENDIF.

MORE INFORMATION

The following is a sample syntax:

<<IF fieldname>>text to print<<ENDIF>>

<<IF fieldname>>text to print<<ELSE>>other text to print<<ENDIF>>

<<IF fieldname="text to match">>text to print<<ENDIF>>

<<IF fieldname="text to match">>text to print<<ELSE>>other text to print<<ENDIF>>

The following is a sample nested IF syntax:

<<IF fieldname1 > number>><<IF fieldname2 = "text to match>>text to print<<ELSE>> other text to print<<ENDIF>> <<ENDIF>>

KBCategory: kbother KBSubcategory: kbmerge Additional reference words: ============================================================================= Copyright Microsoft Corporation 1994.