View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Problems with IF statement

{ MERGEFIELD Title } { MERGEFIELD FirstName } { MERGEFIELD LastName }
{ MERGEFIELD Addr1 }{ IF { MERGEFIELD Addr2 } "" "
{ MERGEFIELD Addr2 }" }
{ MERGEFIELD City } { MERGEFIELD State } { MERGEFIELD Postcode


--

Graham Mayor - Word MVP

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


Joe Di Giulio wrote:
Hello,

I am attempting to cater for a blank address2 in a mail merge. I have
written the following expression:

{ MERGEFIELD Title } { MERGEFIELD FristName } { MERGEFIELD LastName }
{ MERGEFIELD Addr1 }
{ IF { MERGEFIELD Addr2 } = "" "" "{ MERGEFIELD Addr2 }
" }{ MERGEFIELD City } { MERGEFIELD State } { MERGEFIELD Postcode }


The intention is to enter Addr2 and a carriage return if Addr2 is not
blank. I have two problems with this at the moment:
1. The carriage return is not working
2. If the text for Addr2 is "Level 21" only 21 is being displayed.

I have included the spaces in the IF statement as it appears in my
doc. Can someone point out where I have gone wrong? I am using Word
2003

Thanks in advance