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 / August 2004

Tip: Looking for answers? Try searching our database.

IF OR Statement FOR WORD

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newbie@msn.com - 05 Aug 2004 23:26 GMT
THis is a mialmege for WinWord

Can Someone help me with this syntax. If it is not Provider1 or
Provider2 it prints OR

{if
{ MERGEFIELD  Appt_Provider} =   "Provider1"  
OR  
{ MERGEFIELD  Appt_Provider} = "Provider 2"  
" Yes"  " No"}
Doug Robbins - 06 Aug 2004 01:24 GMT
{ IF { MERGEFIELD  Appt_Provider} =   "Provider1" "Yes" { IF { MERGEFIELD
Appt_Provider} =   "Provider2"  "Yes" "No" } }

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

> THis is a mialmege for WinWord
>
[quoted text clipped - 6 lines]
> { MERGEFIELD  Appt_Provider} = "Provider 2"
> " Yes"  " No"}
NewProgrammer@aol.com - 06 Aug 2004 02:06 GMT
Are you saying mailmerge does not support AND or OR Statements?

>{ IF { MERGEFIELD  Appt_Provider} =   "Provider1" "Yes" { IF { MERGEFIELD
>Appt_Provider} =   "Provider2"  "Yes" "No" } }
Greg Maxey - 06 Aug 2004 10:24 GMT
No.  He is showing you how Mailmerge fields are nested in IF fields to
perform AND/OR logic.

Signature

Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in gmaxey@whamspammvps.org

> Are you saying mailmerge does not support AND or OR Statements?
>
>> { IF { MERGEFIELD  Appt_Provider} =   "Provider1" "Yes" { IF {
>> MERGEFIELD Appt_Provider} =   "Provider2"  "Yes" "No" } }
Peter Jamieson - 06 Aug 2004 10:31 GMT
The IF field doesn't support AND and OR. (Have a look in Word Help for the
syntax of these fields!)

If you prefer to use AND and OR explicilty, you can use the following
approach

Use { COMPARE }  to make the comparisons, e.g.

{ COMPARE a = b }

gives 1 if a = b and 0 if a <> b

then use the and and or functions within the { = } field to do the logic:

{ =and(a,b) } is 0 if a is 0 or b is 0, and 1 if a and b are 1

then wrap that inside an IF to give the result you need

{ IF { =and(a,b) } = 1 "result if both a and b are non-zero" "result if
either a or b is 0" }

e.g. to take your example,

{ IF { =or({ COMPARE { MERGEFIELD Appt_Provider } = "Provider1"  },
{ COMPARE { MERGEFIELD  Appt_Provider } = "Provider 2" }) } = 1 "Yes",
"No" }

(I think!)

You can nest ors and ands within the { = } field but notice that in the case
of multiple ors you can should also be able to use

{ IF { ={ COMPARE { MERGEFIELD Appt_Provider } = "Provider1"  }+
{ COMPARE { MERGEFIELD  Appt_Provider } = "Provider 2" } } > 0 "Yes", "No" }

Not the way I'd design the "field language" but there you go.

Signature

Peter Jamieson

> Are you saying mailmerge does not support AND or OR Statements?
>
> >{ IF { MERGEFIELD  Appt_Provider} =   "Provider1" "Yes" { IF { MERGEFIELD
> >Appt_Provider} =   "Provider2"  "Yes" "No" } }
Newbie@msn.com - 06 Aug 2004 12:54 GMT
Thanks for your help. Trying looking for it in Word Help but could not
find it.  Would appreciate if you could steer me to the help screen

Given the complexity of the statement I think I will use the method
listed in a previous reply

I assume that the Select Case is also not supported in a mail merge.
I tried searching help and all I get is stuff on changing from
sentence case to title case

>The IF field doesn't support AND and OR. (Have a look in Word Help for the
>syntax of these fields!)
[quoted text clipped - 32 lines]
>
>Not the way I'd design the "field language" but there you go.
Peter Jamieson - 06 Aug 2004 15:05 GMT
> Trying looking for it in Word Help but could not
> find it.  Would appreciate if you could steer me to the help screen

It depends on the version, but if you look at the Help Table of Contents,
the fields are generally covered in an item called "Field Types and
Switches" near the bottom of the contents list.

> I assume that the Select Case is also not supported in a mail merge.
> I tried searching help and all I get is stuff on changing from
> sentence case to title case

Correct.

Signature

Peter Jamieson

> Thanks for your help. Trying looking for it in Word Help but could not
> find it.  Would appreciate if you could steer me to the help screen
[quoted text clipped - 42 lines]
> >
> >Not the way I'd design the "field language" but there you go.

Rate this thread:






 
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.