IF Statement

S

Shoelaces

I must not understand the construct of IF statements in a mail merge.

I have a Word document (2003) set up as a mail merge from an Access (2003)
database. The records pull contain a field "Sex". The value of that field
is either "M" or "F".

I would like to have the Word document have a sentence such as:
<<First>> has been recognized because because of his/her blah blah blah.

Instead of "he/she", I would like either "he" or "she".

Looking at:
http://support.microsoft.com/?kbid=214827

it appears the structure is:
{if {Sex}= "M" "he" {if {Sex}= "F" "she"}"}

Yet, that does not merge anything.

So, now I am not certain what to do. I would appreciate your help with this.
 
G

Graham Mayor

{IF {Mergefield Sex \*lower} = "m" "he" "she"}

will do the trick. Field boundaries are inserted with CTRL+F9. The rest is
typed.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Shoelaces

Graham Mayor said:
{IF {Mergefield Sex \*lower} = "m" "he" "she"}

will do the trick. Field boundaries are inserted with CTRL+F9. The rest is
typed.

Thank you. I am confused by what is typed and what is inserted.

I have tried many combinations and have not produced a working solution.
May I bother you to explain what to type before I click CTRL+F9?
 
C

Charles Kenyon

If you want a fairly complete set of IF field for gender-specific words, see
the Gender Add-In at http://addbalance.com/word/download.htm. While that
uses tests for a Document Property rather than a merge variable, I would
think the fields would be readily adaptable.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Graham Mayor

You don't need to 'insert' anything, and if you try a more complex
conditional field you will not be able to insert into the dialog boxes.
Build the fields by hand. Type CTRL+F9 which will give you {} then between
the brackets type the rest as I have listed it (with CTRL+F9 for the second
pair of brackets.) If you select a piece of text eg Mergefield Sex before
pressing CTRL+F9, that key combination will put the brackets round the
selected text.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - 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