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 2007

Tip: Looking for answers? Try searching our database.

If -Then-Else Statements in Word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bxgti4x4 - 01 Mar 2007 15:01 GMT
I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.

I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field is
blank but the PostCode field contains data but  when I merge the data,
the whole line is blanked out.

I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field.  AlI I end up with is the
original mergefield.

What I want to say is - [If County = "" show Post Code else County and
PostCode]

Could someone please advise how I should format this line and make it
stay there.

Thanks and Regards
John
Doug Robbins - Word MVP - 01 Mar 2007 15:21 GMT
{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country } { MERGEFIELD PostCode }" }

You must use Ctrl+F9 to insert each pair of field delimiters and Alt+F9 to
toggle off their display.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I have been reading all the posts regarding the use of Word Fields to
> skip a field if the data is blank but I'm still having problems.
[quoted text clipped - 16 lines]
> Thanks and Regards
> John
Graham Mayor - 01 Mar 2007 15:25 GMT
{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield County}
{Mergefield PostCode}"}

Each pair of field boundaries {} is inserted with CTRL+F9. Type the rest.
ALT+F9 to toggle the display.

Signature

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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I have been reading all the posts regarding the use of Word Fields to
> skip a field if the data is blank but I'm still having problems.
[quoted text clipped - 16 lines]
> Thanks and Regards
> John
bxgti4x4 - 01 Mar 2007 16:36 GMT
Thanks Graham and Doug,

That did the trick, I think I was not closing the entry with Alt F9

Thanks for your help.

Best Regards
John

> {IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield County}
> {Mergefield PostCode}"}
[quoted text clipped - 32 lines]
>
> - Show quoted text -
bxgti4x4 - 01 Mar 2007 16:54 GMT
Hello Again,

I have been woking on the field but am finding the following problems:

1   No matter what I do, I end up with a space before the text is
printed.  How do I get rid of this?
2   I wish to put two spaces between County and PostCode but, again,
no matter how many spaces I enter into the code, I still end up with
only one between the two parts of the text.  How do I space the two
part out?

So near and yet so far!

Best Regards
John

> Thanks Graham and Doug,
>
[quoted text clipped - 43 lines]
>
> - Show quoted text -
Doug Robbins - Word MVP - 01 Mar 2007 21:25 GMT
{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country }[  ]{ MERGEFIELD PostCode }" }

If you have two spaces in place of the [  ] above, that is what you will
get.

You should not have { MERGEFIELD Country } anywhere else in the document
except where it appears in the above construction.
Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hello Again,
>
[quoted text clipped - 64 lines]
>>
>> - Show quoted text -
bxgti4x4 - 02 Mar 2007 09:37 GMT
Thanks Doug, that worked OK.  It was odd, I tried it before and it
didn't work - hence my previous post.  Not sure what changed but all
is well.

Thanks very much for your help.

Best Regards
John

On Mar 1, 9:25 pm, "Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org>
wrote:
> { IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
> Country }[  ]{ MERGEFIELD PostCode }" }
[quoted text clipped - 82 lines]
>
> - Show quoted text -
john@jdraper.net - 16 Mar 2007 11:10 GMT
> Thanks Doug, that worked OK.  It was odd, I tried it before and it
> didn't work - hence my previous post.  Not sure what changed but all
[quoted text clipped - 86 lines]
> > >> > > and
> > >> > > PostCode]
I've hit another problem with this code.

Normally, if a field is blank, the line does not print and the
remainder of the address closes up.  However in the line which
contains the code, if the both "County" and "Post Code" are blank, the
line remains, so I get a blank line between "Town" and "Country".

I've tried using a second "If" statement but it makes no difference.
Could someone please advise how I can get rid of the blank line.

Thanks a lot
John

> > >> > > Could someone please advise how I should format this line and make it
> > >> > > stay there.
[quoted text clipped - 9 lines]
>
> - Show quoted text -
 
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.