I've been thrown into a major project involving Word 2003 mailmerge
documents. A big problem is that there is not yet - or, maybe, never
will be, for certain fields - proper data.
In particular, the name prefix - such as "Mr." or "Miss" - is supposed
to be populated in the database but is essentially nonexistent. When a
document prints, and such a field has no data, it prints <None> This is
not acceptable and it certainly doesn't look very good. I've been
looking at lots of Google-searched solutions involving field
placeholders {} but it seems that the series of steps to create a merge
field with an IF statement is very particular. In addition, if it's
blank, it shouldn't take up a space. In other words, if I have
something like:
<<client_Prefix>> <<client_firstname>> and the prefix is blank,
<<client_firstname>> shouldn't appear offset by two spaces from the left.
When I <Insert><Field><Merge field> and type in a name, the field is
formatted with chevrons << >> properly. However, if I try to ad, or
change to, an IF field, all that gets printed is MERGEFIELD or the name
of the merge field, such as "client_prefix"
I'd be grateful if somebody could point me in the right direction. I've
played with first clicking CTRL_F9 to add {} to the document and then
directly adding the IF expression but this hasn't worked, either.
Thanks in advance for any assistance.
"Henry" wrote
[Word 2003]
> I've been looking at lots of Google-searched solutions involving
> field placeholders {} but it seems that the series of steps to create
> a merge field with an
> IF statement is very particular.
choose "View | Toolbars | Mail Merge". In the toolbar you will find a
command "Insert Word Field | If.. then ... else". Now you can "build"
your If-statement.
> In addition, if it's blank, it shouldn't take up a space. In other
> words, if I have something like:
> <<client_Prefix>> <<client_firstname>> and the prefix is blank,
> <<client_firstname>> shouldn't appear offset by two spaces from the
> left.
Don't add a space between the Mergefields. Instead, right click on the
field "client_Prefix", choose "edit field" and enable "space after"
inserting a space.
Now a switch (\f) and a space between quotes has been added to the
field: { MERGEFIELD client_Prefix \ f " "}
To toggle between field codes and results use ALT + F9.
> the field is formatted with chevrons << >> properly.
Maybe properly ... but you will not see the field code behind. Use
Alt+F9 to show the field code.
--
Cheers
Lisa [MS MVP Word]
The If...Then...Else builder definitely adds some capabilities I could
use - and didn't know about. There's one problem, though - the "Insert
Word Field" menu option is only available if the document has been set
up as a Letter. All of the documents I'm working with have been set up
as normal Word documents. If I then click the "Merge document setup"
icon and change the document to "Letter" I can, indeed, insert an
"If...Then...Else..." field, but the first item to be selected is "Field
name" - but no field names are listed, and you cannot simply type in a
name. As a result, I'm unable to utilize this utility. Am I still
missing something?
I checked this on my laptop - using Word 2002, and I remotely logged on
to my computer at work which uses Word 2003, with the same results. Is
there a way around this, or do I have any ether options?
Of course, now I have to read about the other types of fields available
via the "Insert Word field" utility... it never ends... aaarrggghh...
{IF{ Mergefield Fieldname } <> "" "{Mergefield Fieldname}"}
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
"Henry" <gree...@optonline.net> wrote in message
news:4cd4bd3b$0$31276$607e...@cv.net...
So the format would be:
{ If { MERGEFIELD client_prefix } = "" "{ MERGEFIELD client_lastname }"
ELSE "{ MERGEFIELD client_prefix }" " " "{client_last_name }" }
Would that be about right? If the prefix is blank, just print the last
name, otherwise print the prefix and a space and the last name.
Thanks again for your help.
{IF TEST = CONDITION "DO THIS" "ELSE DO THIS" } thus
{ IF { Mergefield client_prefix } = "" "{ Mergefield client_lastname }" "{
Mergefield client_prefix } { Mergefield client_lastname }" }
Or even simpler
{ IF { Mergefield client_prefix } <> "" "{ Mergefield client_prefix } " }{
Mergefield client_lastname }
Note the space between the field and the quote in the second version. There
is no space between the fields.
Note also that you had two different spellings for the last name field name?
I have shown one of them ;)
You may find http://www.gmayor.com/formatting_word_fields.htm useful.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
"Henry" <gree...@optonline.net> wrote in message
news:4cd56482$0$7147$607e...@cv.net...
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
"Henry" <gree...@optonline.net> wrote in message
news:4cd57c98$0$7113$607e...@cv.net...
I found that I had to test for the string "<None>" and not "" to
actually handle a blank merge value. I believe that <None> is how the
system was handling a NULL database value.
Now I put that in my toolbox for the future - one more wheel I don't
have to reinvent.
Graham Mayor wrote:
> You are welcome. :)
>
>