Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / March 2004

Tip: Looking for answers? Try searching our database.

Re: Conditional IF with MERGEFIELD

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd Spear - 22 Mar 2004 01:47 GMT
Hi there,

I looked up the sytax for the conditional if for Word 2000
and having a problem.  I can do a simple test ok.  The
problem is this:

I have a last_name field and a Husband and Wife field in an
access 2000 database.  The husband or wife field could be
for a single male or female.

I am needing to make labels so that if there is a Husband
and wife field: Print "MERGEFIELD Husband & MERGEFIELD Wife
MERGEFIELD Last_Name"  If Either are blank then it would
print the field for a single female: "MEREGFIELD Wife
MERGEFIELD Last_name" or Male "MERGEFIELD Husband
MEREGFIELD Last_name"

I referenced KB article: 214827

To create an "AND" statement (Position the second test
inside the first set of quotation marks):

{IF test1 "{IF test2 "TrueResult" "FalseResult"}"
"FalseResult"}

I cannot get this to work

Any help or samples would be appreciated

Regards,

Todd
Peter Jamieson - 22 Mar 2004 09:26 GMT
Try

{ IF "{ MERGEFIELD Husband }" <> ""
"{ IF "{ MERGEFIELD Wife }" <> ""
"{ MERGEFIELD Husband } & { MERGEFiELD Wife }"
"{ MERGEFIELD Husband }" }"
"{ IF "{ MERGEFIELD Wife }" <> ""
"{ MERGEFIELD Wife }"
"whatever you want if both Husband and Wife are blank" }"
} { MERGEFIELD Last_name }

where all the {} are the special field braces you can insert using ctrl-F9.
This will only work if the Husband/Wife fields are completely empty (not
even any spaces in the names).

Signature

Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> Hi there,
>
[quoted text clipped - 28 lines]
>
> Todd
Graham Mayor - 22 Mar 2004 09:32 GMT
In the following example, all field boundaries {} are inserted with CTRL+F9.
While the speech marks are not strictly necessary with fields, without them
you completely lose the plot :(

{IF {Mergefield Husband} <> "" "{IF {Mergefield Wife} <> "" "{Mergefield
Husband} & {Mergefield Wife}" "{Mergefield Husband}"}" "{Mergefield Wife}" }
{Mergefield Last_Name}

Signature

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

  Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Hi there,
>
[quoted text clipped - 28 lines]
>
> Todd
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.