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.

Another Mail Merge Problem - Word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john@jdraper.net - 16 Mar 2007 13:54 GMT
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.  In an earlier post Doug
Robbins showed me how to use If-Then-Else coding to print, one or
other or both fields but I've hit another problem.

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.

Best Regards
John
Peter Jamieson - 16 Mar 2007 14:15 GMT
How about

{ IF "{ MERGEFIELD County }" = "" "" "{ MERGEFIELD County }  " }{ MERGEFIELD
Postcode }

The thing about blank line suppression is that it isn't any old blank line
that's suppressed - it's blank lines formed from MERGEFIELD fields, but
MERGEFIELD fields nested inside some other construct such as an IF field
don't count. So only by inserting a MERGEFIELD that you know to be blank can
you suppress the line.

More or less.

Peter Jamieson

>I have two Mergefields on the same line <<County>> and <<PostCode>>.
> In some cases, like sending a letter to Australia, the County field is
[quoted text clipped - 11 lines]
> Best Regards
> John
john@jdraper.net - 16 Mar 2007 14:33 GMT
Peter,

Thanks for the advice.  The code at present is as follows:

{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode }
"{ MERGEFIELD
Country } { MERGEFIELD PostCode }" }

I understand what you are saying but, if, as you suggest, I put
{Mergefield Postcode} at the end, it will be OK if Potscode is blank
but if it is not, I will get Postcode twice.

I'm not sure how this solves the problem.

Best Regards
John

On 16 Mar, 13:15, "Peter Jamieson" <p...@KillmapSpjjnet.demon.co.uk>
wrote:
> How about
>
[quoted text clipped - 32 lines]
>
> - Show quoted text -
john@jdraper.net - 16 Mar 2007 14:47 GMT
Thanks Graham,

It seems very complicated but it works - I won't pretend to understand
how!

Best Regards
John

On 16 Mar, 13:33, j...@jdraper.net wrote:
> Peter,
>
[quoted text clipped - 54 lines]
>
> - Show quoted text -
Graham Mayor - 16 Mar 2007 15:14 GMT
It is quite simple:
Town
If the county has content move down a line and enter the county and the
postcode (it doesn't matter of the postcode is empty here as the blank space
is at the end of the line).
If the county has no content have a look in postcode.
If postcode has content move down a line and enter the postcode
If both county and postcode are empty stay on the line with town
then move down a line and add the country.

Signature

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

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

> Thanks Graham,
>
[quoted text clipped - 65 lines]
>>
>> - Show quoted text -
john@jdraper.net - 16 Mar 2007 15:30 GMT
Thanks to both Peter and Graham for taking the trouble to explain how
their code works.  I'm really grateful to both of you for your posts
as they have solved my problem.

Best Regards
John

> It is quite simple:
> Town
[quoted text clipped - 86 lines]
>
> - Show quoted text -
Peter Jamieson - 16 Mar 2007 14:52 GMT
> I understand what you are saying but, if, as you suggest, I put
> {Mergefield Postcode} at the end, it will be OK if Potscode is blank
> but if it is not, I will get Postcode twice.

I don't think so, with the code I posted, unless you also have { MERGEFIELD
Postcode } on another line. Here's my effort, with County->Country

>> { IF "{ MERGEFIELD Country }" = "" "" "{ MERGEFIELD Country }  " }{
>> MERGEFIELD
>> Postcode }

If  Country is blank, the IF field returns blank and you get { MERGEFIELD
Postcode }. However, if Postcode is also blank then the line should be
suppressed.

If Country is non-blank you get { MERGEFIELD Country } and two spaces from
the IF field, then { MERGEFIELD Postcode }. If the Postcode is blank then
you don't actually need those two spaces but there you are.

But I didn't read the original thread so maybe there is more to it than you
have said in this one. Or maybe Graham's submission has sorted it for you.

Peter Jamieson

> Peter,
>
[quoted text clipped - 54 lines]
>>
>> - Show quoted text -
Graham Mayor - 16 Mar 2007 14:29 GMT
You need something a tad more complex eg

{ Mergefield Town }{ IF { Mergefield County } <> "" "¶
{ Mergefield County } { Mergefield  PostCode}" "{ IF { Mergefield PostCode }
<> "" "¶
{ Mergefield  PostCode}" ""}"}¶
{ Mergefield Country }

When compiling this press the enter key wherever you see ¶ (and nowhere
else!)

Signature

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

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

> I have two Mergefields on the same line <<County>> and <<PostCode>>.
> In some cases, like sending a letter to Australia, the County field is
[quoted text clipped - 11 lines]
> Best Regards
> John
oli merge - 19 Mar 2007 16:46 GMT
Hi, Im just typing here because I cant seem to make a new thread...

can someone tell me how to urgently (clicking "new" is doing nothing). I
will then delete this post

> You need something a tad more complex eg
>
[quoted text clipped - 22 lines]
> > Best Regards
> > John
Graham Mayor - 19 Mar 2007 16:57 GMT
> Hi, Im just typing here because I cant seem to make a new thread...
>
> can someone tell me how to urgently (clicking "new" is doing
> nothing). I will then delete this post

You cannot delete this post! It will have already been distributed to a
variety of independent servers and will have been archived at Google.

You have either accessed the forum via one of a variety of web portals or
you have accessed the server using either your service provider's news feed
or accessed the Microsoft server directly. The latter is the simplest
option - see http://www.gmayor.com/MSNews.htm

Signature

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

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

 
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.