View Single Post
  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Another Mail Merge Problem - Word 2003


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

wrote in message
oups.com...
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"
wrote:
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

wrote in message

oups.com...



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- Hide quoted text -


- Show quoted text -