Need help with selective merge

G

Graywolf

I'm running a merge document and putting values into a table. I can put the
merge fields into the table just fine. Here's the problem: I have 3 fields
which may or may not have data in them, and the client doesn't want any empty
rows. Is there a way to format a row so it compresses down to nothing if the
mergefield is blank. Or a second approach would be to put the second field
into the first fields position if the first field is empty, but I would also
need to be able to put the third field into the first fields position if the
first and second fields were empty. (I hope I'm making sense.) I know you
can do an If...then...else in a mailmerge but it does not look like you can
nest them in order to cover the 3 fields I need to check. Thanks in advance
for any help.
 
D

Doug Robbins - Word MVP

You can certainly "nest" If...then...Else field constructions, but if you
are setting up your mail merge main document so that if all 3 fields contain
data, that data is shown on individual rows of a table, then if you use an
If...then...Else field construction to overcome the case where for example
field 1 is empty by moving field 2 to the field 1 row and field 3 to the
field 2 row, yuo are going to end up with n empty field 3 row. Would that
be acceptable?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graywolf

Yes, your suggestion would be perfect. It's OK for me to have blank rows at
the end. They don't want them in the middle. Can you show me the syntax for
nested If...Then... Else ?? I have tried to use:
{IF {MERGEFIELD FFC} <> "", {MERGEFIELD FFC}, {IF {MERGEFIELD INO} <> "" ,
{MERGFIELD INO}, {MERGEFIELD DC_TEXT}}}

but all I get is a blank value. In my example I have data in all 3 fields
so I would expect to see the value in the FFC field because it's not blank,
but I'm getting nothing.

Thanks again,
 
D

Doug Robbins - Word MVP

In the first row

{ IF { MERGEFIELD FFC } <> "" { MERGEFIELD FFC } { IF { MERGEFIELD INO } <>
"" { MERGEFIELD INO } { MERGEFIELD DC_TEXT } } }

In the second row

{ IF { MERGEFIELD FFC } <> "" { IF { MERGEFIELD INO } <> "" { MERGEFIELD
INO } { MERGEFIELD DC_TEXT } }{ IF { MERGEFIELD INO } <> "" { MERGEFIELD
DC_TEXT } "" }

In the third row

{ IF { MERGEFIELD FFC } <> "" { IF { MERGEFIELD INO } <> "" { MERGEFIELD
DC_TEXT } "" } "" }

In If...then...Else field constructions in Word, you do not use comma
separators as in Excel or Access.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graywolf

Doug,
Thanks for your continued help and please forgive my thickheadedness for not
being able to get over what I think is probably a very simple syntax error,
but I'm still having a slight problem. I think we're on the right track but
I'm missing something. I copied and pasted the code samples you gave me,
then highlighted the mergefield references and did an Insert, Mergefield and
selected the appropriate mergefield to replace your text reference. The
following is what gets displayed for a record that has all 3 fields blank.
It's not showing any data, which is fine because there is no data in those
fields, but I am seeing the If statements, operators, comparison strings, and
delimiting braces. What am I missing ?

{IF <> "" { IF <> "" }}

{ IF <> "" { IF <> "" }{ IF <> "" "" }

{ IF <> "" { IF <> "" "" } "" }


Thanks again.
 
D

Doug Robbins - Word MVP

You cannot copy and paste the field construction. You must use Ctrl+F9 to
insert each pair of field delimiters { }. Where the mergefields themselves
however appear in the construction, you can get the { MERGEFIELD fieldname }
bit by inserting the mergefield into the required location in the
construction.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

You're welcome.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top