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

Tip: Looking for answers? Try searching our database.

2 conditions, or 'like' condition?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leslie Isaacs - 22 Apr 2004 15:48 GMT
Hello All

I need to have some text in my document that depends on
whether the merge field 'type_name' starts with the
word 'NURS'. i.e if type_name is Nurse Practitioner or
Nursing auxilliary or Nurse locum etc etc etc I
want "clinical" otherwise I want "Administrative"

How do I do that? I have tried the help files, which
suggested nesting 2 if statements (so type_name>nt and
type_name<nv), but couldn't get it to work. Is there
a 'like' operator that I could use with a wildcard, so
something like

{IF {MERGEFIELD type_name} like "nurs"
& "*" "Clinical" "Administrative"}

Hope someone can help!

Many thanks
Leslie Isaacs
Cindy M  -WordMVP- - 22 Apr 2004 18:53 GMT
Hi Leslie,

If you can't add this information in your data source
(which you unfortunately don't mention). And no, Word
doesn't support "Like". Closest you can get is a COMPARE
field; you'll want to read up on it in the Help, and do
note that it is case-senstive. Here's an exmaple

{ IF { Compare "{ Mergefield type_name }" = "Nurs*" } = 0
"Administration" "clinical" }

> I need to have some text in my document that depends on
> whether the merge field 'type_name' starts with the
[quoted text clipped - 10 lines]
> {IF {MERGEFIELD type_name} like "nurs"
> & "*" "Clinical" "Administrative"}

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)
- 23 Apr 2004 10:22 GMT
Cindy
Many thanks for your reply. The example you gave in fact
worked a treat without my even having to read up
the 'Help' - although I have spent some time there so that
I understand the syntax.
Thanks again
Les.
NB. my data source is an access mdb.

>-----Original Message-----
>Hi Leslie,
[quoted text clipped - 34 lines]
>
>.
Cindy M  -WordMVP- - 23 Apr 2004 16:11 GMT
> Many thanks for your reply. The example you gave in fact
> worked a treat without my even having to read up
> the 'Help' - although I have spent some time there so that
> I understand the syntax.
> NB. my data source is an access mdb.

Glad it worked for you :-)

Note that, given Access, I'd have probably chosen to do this
in an "expression" in an Access query. Since Access supports
wildcards and other functions Word does not have, it's often
more efficient. Plus, if you're going to need it often, you
only have to do it the one time and can re-use the query for
other merges.

The expression could look something like this:

TypeOfJob: IIF(Left([type_name],
4)="nurs","clinical","admin")

TypeOfJob would then show up in your datasource as a merge
field.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep
30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :-)
 
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.