View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default how to suppress a line having a nil or zero value in a merge f

OK, let's try to go through step by step.

1. Can you post the details of the (relevant) fields here, e.g. do you just
have
(a)
{ MERGEFIELD "first name" } { MERGEFIELD "last name" }
{ MERGEFIELD "home address" }
{ MERGEFIELD "home phone***" }
{ MERGEFIELD "mobile phone" }
{ MERGEFIELD "other address***" }
{ MERGEFIELD home2phone***" }

or maybe something like
(b)
Name: { MERGEFIELD "first name" } { MERGEFIELD "last name" }
Home address: { MERGEFIELD "home address" }
Home phone: { MERGEFIELD "home phone***" }
Mobile: { MERGEFIELD "mobile phone" }
Other address: { MERGEFIELD "other address***" }
Other phone: { MERGEFIELD home2phone***" }

or maybe you have some IF fields, or what?

You can use Alt-F9 to display the underlying field codes, i.e. where they
show as { MERGEFIELD something }. however, you can't just cut/paste the
entire sequence of fields and text into a message here, so you may have to
copy by hand. (Actually, there are macros to do this but let's assume that's
a complication we don't need for now).

2. Do some of your field names really have *** at the end? If so, there's
probably nothing wrong with that, but I would at least check that that is
not a factor here.

If your fields look something like the example in 1(a) then there should be
no problem. If they look more like 1(b) then lines will never be suppressed
because there is something else on the line.

Peter Jamieson

"SandeeB@Benson's Inc." wrote
in message ...
Peter, I think I'm experiencing the same problem--I'm mail merging 820
unit
owners into an annual directory (Word 2003 template) from an MS Outlook
saved
contacts file.

The fields I'm using are "last name", "first name", "home address", "home
phone***", "mobile phone", "other address***", and "home2phone***".

Some of our residents live here year-round; therefore, the "other",
"mobile
phone" and "home2phone" fields have no data in them. Same is true for
"home
phone" in some instances. A good percentage of our residents have "other
addesses" and "home2phones".

How can I close up the "gap" when fields are blank???? Is there is a
specific "If" formula for this? I've been through the MS Word 2003
"Inside
Out" book 4 times trying to figure this out to no avail and unfortunately,
your thread was a little too "technical" forme to understand. Could you
PLEASE HELP???? Thanks so much!
"Peter Jamieson" wrote:

If the value is null, i.e. { MERGEFIELD myfield } displays no text, then

{ MERGEFIELD myfield }

on its own in an otherwise blank line should result in a suppressed line,
assuming that "suppress blank lines" is swithced on, which it is by
default
in Word 2002/2003,

If the value is 0, things are harder. If you have a field in your data
source which is always blank, you can use

{ IF { MERGEFIELD myfield } = 0 "" "{ MERGEFIELD myfield }" }{ MERGEFIELD
myblankfield }

Word will /not/ suppress the line if it is blank because of the result of
the IF field:

{ IF { MERGEFIELD myfield } = 0 "" "{ MERGEFIELD myfield }" }

even if you try:

{ IF { MERGEFIELD myfield } = 0 ""{ MERGEFIELD myblankfield}" "{
MERGEFIELD
myfield }" }

Finally, in Word 2002/2003, Word will not suppress these blank lines if
they
are nested inside another field such as an IF or INCLUDETEXT. Your only
option then is to use an IF to generate a new paragraph when the field is
/not/ blank or 0, e.g.


{ IF "{ MERGEFIELD myfield }" = "" ""
"{ IF { MERGEFIELD myfield } = 0 ""
"{ MERGEFIELD myfield }
" }

(There needs to be a new paragraph before the final double-quote mark)

Peter Jamieson

"Martin" wrote in message
...
I need to know how to suppress a line if the merge field value is zero