View Single Post
  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
SandeeB@Benson's Inc.
 
Posts: n/a
Default how to suppress a line having a nil or zero value in a merge f

You indicate that you thought I was using Word 2002; I'm using 2003
version--is there something different I'll need to do???

Thanks, Peter.

SANDEE B.

"Peter Jamieson" wrote:

Hi Sandee,

(b) is how I have the "form" directory
set up.


Ok, that explains it.

To do this...

BROWN, Sandee
00000 Reflection Lakes Drive #0000
239-000-0000 (home)
0000 W. Main Street
239-000-0000 (mobile)
Anytown, US 00000
888-000-0000 (away)


....since you're using Word 2002 you can use the \f switch to append text
after the field result if the field is non-blank.

e.g., use something more like

{ MERGEFIELD "last name" }, { MERGEFIELD "first name" }
{ MERGEFIELD "home address" }
{ MERGEFIELD "home phone" \f " (home)" }
{ MERGEFIELD "mobile phone" \f " (mobile)" }
{ MERGEFIELD "other address" }
{ MERGEFIELD home2phone" \f " (away)" }

To do that, use Alt-F9 until you see the fields as { MERGEFIELD
thefieldname } and just type the \f " (home)" or whatever into the field -
follow the spacing I've given as an example.

Peter Jamieson

"SandeeB@Benson's Inc." wrote
in message ...
Thanks for your prompt reply, Peter. (b) is how I have the "form"
directory
set up. I have NO "If" statements because I don't understand how to do
that.
No, there are no "****" after the fields....I just asterisked these fields
as these are the ones that there may or may not be data in inside the
Contacts file. So are you suggested that I modify my form to "match" your
example (a) wherein you indicate that the fields would automatically be
suppressed? The problem is, in a directory, we would like to have each
entry
appear after the merge as follows:

BROWN, Sandee
00000 Reflection Lakes Drive #0000
239-000-0000 (home)
0000 W. Main Street
239-000-0000 (mobile)
Anytown, US 00000
888-000-0000 (away)

Once the alphabetical merge has been performed successfully, we will also
be
including a "By Street" sort list in this directory.

Thanks for any additional help you can provide me on this project. I
really
appreciate it!

SANDEE B.



"Peter Jamieson" wrote:

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