Blank SPACES Not Suppressed During Conditional Mail Merge
  
PSS ID Number: Q115156
Article last modified on 08-11-1995
 
6.00 6.00a  6.00c 7.00 |6.00 6.0.1
 
WINDOWS                |MACINTOSH
 

-------------------------------------------------------------------
The information in this article applies to:
 
 - Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 - Microsoft Word for Windows 95, version 7.0
 - Microsoft Word for the Macintosh, versions 6.0, 6.0.1
-------------------------------------------------------------------
 
SYMPTOMS
========
 
When you perform a mail merge in Word 6.0 or 6.0a for Windows, blank spaces
may not be suppressed when you use one of the standard conditional
statements.
 
Note: A similar problem occurs in which Word does not suppress blank LINES
in a conditional mail merge. For information about this topic, query on the
following words in the Microsoft Knowledge Base:
 
   suppress* and blank and lines and conditional
 
STATUS
======
 
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
 
WORKAROUNDS
===========
 
Condition 1:  The first field in a series of fields is the conditional
------------  argument.
 
Use one of the following conditional MERGEFIELD examples to suppress the
unwanted space at the beginning of the merge result and to ensure you have
the appropriate spacing when the condition is true.
 
 - In this first example, there must be a space before the closing
   quotation mark immediately following {MERGEFIELD title} in the true
   test. If the space is not included, the merge will be incorrect. Notice
   that there is no space between the conditional MERGEFIELD and the last
   MERGEFIELD.
 
      {if{mergefield title}<> "" "{mergefield title}<space>"}{mergefield
       name}
 
 - The following statement provides the desired result even though the
   syntax is incorrect (the missing ending quotation marks after the
   MERGEFIELD). There is no space between the true and false tests, but
   there is a space immediately between the two closing braces at the end
   of the conditional statement.
 
      {if{mergefield title}<> "" "{mergefield title}<space>}{mergefield
       name}
 
Condition 2:  The field occurs in the middle of a series of fields.
------------
 
For example, if you want to suppress a middle initial between a firstname
and lastname fields, then you can use one of the following MERGEFIELDs to
get the correct results:
 
 - In the following example, a space is included in the true test
   immediately following {¬MERGEFIELD middle} but before the ending
   quotation marks.
 
      {mergefield firstname} {if{mergefield middle}<> "" "{mergefield
       middle} <space>"}{mergefield lastname}
 
 - In the next example, there is a space inserted between the ending field
   brace for {¬MERGEFIELD middle} and the ending brace for the conditional
   field. When the fields are merged, the true test will provide a space if
   the middle initial is included, but a space will not be included if the
   middle initial doesn't exist.
 
      {mergefield firstname} {if {mergefield middle}<> "" "{mergefield
       middle} <space>}{mergefield lastname}
 
The Insert Word Field Feature
-----------------------------
 
If you used the MailMerge Helper to set up your main document and attach a
data file, you can add conditional MERGEFIELD statements by choosing the
Insert Word Field button. Using this option can produce incorrect results
during the merge unless the space is added before the ending quotation
marks after {¬MERGEFIELD title} in the true test. Below is an example of how
the field is inserted into the document using this method:
 
   { if { mergefield title } <> "" "{ mergefield title }" "" } {mergefield
    name}
 
Unless the conditional field is modified so that the space is included as
part of the conditional statement, the result will be no space when the
title field is true and one space before the name field when the result is
false. When modified, the conditional line would read as follows:
 
   { if { mergefield title } <> "" "{ mergefield title }<space>"}
    {mergefield name}
 
MORE INFORMATION
================
 
If you are trying to suppress the blank space at the beginning of a line
when the first field is empty, the following examples work incorrectly:
 
   {if{mergefield title}<> "" "{mergefield title}"} {mergefield name}
 
   {if{mergefield title}<> "" "{mergefield title}"}{mergefield name}
 
   {if{mergefield title}<> "" "{mergefield title}} {mergefield name}
 
In the first and third examples above, when the test is true, the result
displays and prints with one space between the title and the name; when the
result is false, there is one space before the name result--in other words,
at the beginning of the line.
 
The second example yields correct results if there is no title. If the
result of the conditional statement returns both a title and a name, there
is no space between the title and the name.
 
If you are trying to suppress the blank spaces for an empty field result in
the middle of a series of fields, the following examples do NOT work
correctly:
 
 - In the first example below, two spaces will be placed between the
   firstname and the lastname fields when the result is false (when there
   is no middle name). If the middle name is not blank, the result will
   print correctly.
 
      {mergefield firstname} {if {mergefield middle} <> "" "{mergefield
       middle}"} {mergefield lastname}
 
 - In the next example, if the middle name exists, there will be no space
   between the middle name and the last name. If the middle name does not
   exist, the result will correctly place a space between the firstname and
   lastname results.
 
      {mergefield firstname} {if {mergefield middle} <> "" "{mergefield
       middle}"}{mergefield lastname}
 
 - In the final example, two spaces will occur when there is no middle
   name. When the middle name exists, one space will be placed before the
   middle name and two spaces will be placed between the middle name and
   the last name.
 
      {mergefield firstname} {if {mergefield middle} <> "" "{mergefield
       middle}} {mergefield lastname}
 
KBCategory: kbprint
KBSubcategory: kbmerge
Additional reference words: 6.00 6.00a incorrect conditional 6.0.1
macword 6.00c 7.00 word95 winword mergefield suppress blank space
 
=============================================================================
 
Copyright Microsoft Corporation 1995.
