I'm trying to apply an IF statement to a mailmerge field in a document. The
field in question is a 'Name' and is stored in the database as, for example,
'Paul_Jacques'. What I want to do is strip out the underscore and replace it
with a SPACE. I've tried the following:
IF "Paul_Jacques" "Paul Jacques" IF "Nick_Hunter" "Nick Hunter" IF
"Anthony_Robinson" "Anthony Robinson"
Although it seems to accept the entry, on the print itself it only ever
prints "Paul Jacques" regardless of the relevant name. What have I done wrong?
This sounds a tad bizarre unless you have not explained it well.
What difference does it make what the fieldnames are called? It is the
record content of those fields that matters.
Or do you really have a field called 'Name' which contains these underscored
names? In which case
{ IF { Mergefield Name } = "Paul_Jaques" "Paul Jaques" "{ IF { Mergefield
Name } = "Nick_Hunter" "Nick Hunter" "{ IF { Mergefield Name } =
"Anthony_Robinson" "Anthony Robinson" "{ Merfefield Name }" }" }" } would
probably be nearer the mark?

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I'm trying to apply an IF statement to a mailmerge field in a
> document. The field in question is a 'Name' and is stored in the
[quoted text clipped - 8 lines]
> ever prints "Paul Jacques" regardless of the relevant name. What have
> I done wrong?
Paul J - 11 May 2007 12:05 GMT
Hi Graham,
Yes the info is coming from a mergefield. I did originally start with a
variation of what you have provided. Sorry my description was a little
unclear. I'll give your example a try.
Thanks
> This sounds a tad bizarre unless you have not explained it well.
> What difference does it make what the fieldnames are called? It is the
[quoted text clipped - 18 lines]
> > ever prints "Paul Jacques" regardless of the relevant name. What have
> > I done wrong?
Paul J - 11 May 2007 14:52 GMT
Hi,
I've tried what you suggested but unfortunately, the field isn't big enough
to enter all of the statement. Is there anyway of abbreviating this or is
there somewhere else I can enter it?
Currently, I'm right-clicking the mergefield, then 'Edit Field', selecting
'If' from the 'Field names' list and then entering the statement in the
'Field Codes:' prompt.
> This sounds a tad bizarre unless you have not explained it well.
> What difference does it make what the fieldnames are called? It is the
[quoted text clipped - 18 lines]
> > ever prints "Paul Jacques" regardless of the relevant name. What have
> > I done wrong?
Graham Mayor - 11 May 2007 16:03 GMT
You cannot enter a nested field of this complexity using the field tool.
You will have to enter from the keyboard using CTRL+F9 for each field
bracket pair.
Nake sure you get the brackets and the quotes in the right places or it
won't work - and don't do as I did originally and spell Mergefield
incorrectly ;)

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Hi,
>
[quoted text clipped - 36 lines]
>>> ever prints "Paul Jacques" regardless of the relevant name. What
>>> have I done wrong?
Paul J - 11 May 2007 17:13 GMT
Hi Graham,
Thanks once again. I'll see how I get on
> You cannot enter a nested field of this complexity using the field tool.
> You will have to enter from the keyboard using CTRL+F9 for each field
[quoted text clipped - 43 lines]
> >>> ever prints "Paul Jacques" regardless of the relevant name. What
> >>> have I done wrong?
Ed - 11 May 2007 18:33 GMT
Hi Paul,
As Graham suggests, you need to ensure that you get the curly brackets and
the quotes in the right places when you're creating your fields and this can
be quite tricky if you build up the fields in the "natural" left-to-right
way. For an alternative way to construct some types of nested IF fields which
I find to be easier to get right, check out the first parts of this thread:
http://groups.google.co.uk/group/microsoft.public.word.mailmerge.fields/browse_t
hread/thread/dfd4c09138b03c04/6d5a1a841baa79cb?lnk=st&q=&rnum=1&hl=en#6d5a1a841b
aa79cb
I won't duplicate the content here as I was just a tab verbose when I wrote
my part:-)
Regards.
Ed
> Hi Graham,
>
[quoted text clipped - 47 lines]
> > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > >>> have I done wrong?
Ed - 11 May 2007 18:56 GMT
Hi Ed,
"a tab verbose"??? Surely you meant "tad"!
Yes, Ed, I did. I spotted it a microsecond after I pressed the Post button.
Always the way:) Thanks for pointing it out.
I'm welcome.
Regards.
Ed
> Hi Paul,
>
[quoted text clipped - 64 lines]
> > > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > > >>> have I done wrong?
Paul J - 14 May 2007 10:31 GMT
Hi Ed,
Many thanks for that. I have checked the thread and tried the following.
However, all that prints out is 'Mergefield'. I'm obviously still going wrong
somewhere:
{ if { Mergefield UserResponseAssignedTo } = "Orla_Byrne" "Orla Byrne" "{ IF
{Mergefield UserResponseAssignedTo } = "Brenda Corrigan" "Brenda Corrigan" "{
IF { Mergefield UserResponseAssignedTo } = "Ingrid_Dempsey" "Ingrid Dempsey"
"{ IF { Mergefield UserResponseAssignedTo } = "Laura_O'Carroll" "Laura
O'Carroll" "{ Mergefield UserResponseAssignedTo}" }" }" }" }
Thanks
Paul
> Hi Ed,
>
[quoted text clipped - 77 lines]
> > > > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > > > >>> have I done wrong?
Ed - 14 May 2007 13:33 GMT
Hi Paul,
To me the structure looks OK. Any chance you've used the curly brackets on
the keyboard to insert some of the field braces? When you create fields
manually you need to use CTRL+F9.
There are a couple of ways to tell. By default at least, the "true" field
braces look bolder than ordinary curly brackets. Also, try selecting each
field brace in turn and see what shows as selected.
My guess would be the final { Mergefield UserResponseAssignedTo}.
Regards.
Ed
> Hi Ed,
>
[quoted text clipped - 93 lines]
> > > > > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > > > > >>> have I done wrong?
Paul J - 14 May 2007 16:02 GMT
Hi Ed,
Thats exactly what it was. Many thanks for all your help.
Paul
> Hi Paul,
>
[quoted text clipped - 109 lines]
> > > > > > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > > > > > >>> have I done wrong?
Ed - 14 May 2007 18:04 GMT
You're welcome.
Regards.
Ed
> Hi Ed,
>
[quoted text clipped - 115 lines]
> > > > > > > >>> ever prints "Paul Jacques" regardless of the relevant name. What
> > > > > > > >>> have I done wrong?