A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

mail merge - conditions and line breaks



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2010, 08:40 PM posted to microsoft.public.word.mailmerge.fields
Peter
external usenet poster
 
Posts: 962
Default mail merge - conditions and line breaks

I’m newly working at the NZ affiliate of an international charitable
organisation. The database currently used is fairly old and some fields were
never perfectly consistent with our local situation. So over the years data
entry has been inconsistent. Medium term goal is a new international
database and cleansed data, but in the meantime I would appreciate coding
ideas for a specific scenario.

For addresses in all correspondence the field layout should include:

Suburb (if not null)
City Postcode

Where Suburb and City both have values, the data entry is consistent.
But where Suburb is blank (eg for a small rural town) the City value may
have been typed into the Suburb or City field. In such a case the
alternate field will then be null.

So I need a set of conditional field merges that cover (I think) three
possibilities:

Suburb
City Postcode

or
City Postcode (if Suburb is Null)

or
Suburb Postcode (if City is Null)

I can do bits of this but am having trouble with the layout needing to be on
one or two lines. I presume I need to insert a line break or equivalent but
don’t know how to code this.

Thanks in advance for any help.

Peter.
  #2  
Old May 5th, 2010, 11:07 PM posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default mail merge - conditions and line breaks

Use the following field construction

{ IF { MERGEFIELD Suburb } "" "{ IF { MERGEFIELD City } "" "{
MERGEFIELD Suburb }¶
{ MERGEFIELD City } { MERGEFIELD PostCode }" "{ MERGEFIELD Suburb } {
MERGEFIELD PostCode }" } "{ MERGEFIELD City } {MERGEFIELD PostCode }" }

Where the ¶ appears in the above, press Enter (or Shift+Enter)

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

--
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, originally posted via msnews.microsoft.com

"Peter" wrote in message
...
I’m newly working at the NZ affiliate of an international charitable
organisation. The database currently used is fairly old and some fields
were
never perfectly consistent with our local situation. So over the years
data
entry has been inconsistent. Medium term goal is a new international
database and cleansed data, but in the meantime I would appreciate coding
ideas for a specific scenario.

For addresses in all correspondence the field layout should include:

Suburb (if not null)
City Postcode

Where Suburb and City both have values, the data entry is consistent.
But where Suburb is blank (eg for a small rural town) the City value
may
have been typed into the Suburb or City field. In such a case the
alternate field will then be null.

So I need a set of conditional field merges that cover (I think) three
possibilities:

Suburb
City Postcode

or
City Postcode (if Suburb is Null)

or
Suburb Postcode (if City is Null)

I can do bits of this but am having trouble with the layout needing to be
on
one or two lines. I presume I need to insert a line break or equivalent
but
don’t know how to code this.

Thanks in advance for any help.

Peter.


  #3  
Old May 8th, 2010, 09:34 AM posted to microsoft.public.word.mailmerge.fields
Peter
external usenet poster
 
Posts: 962
Default mail merge - conditions and line breaks

Thanks for your help. This has been just what I needed to sort things out.

Peter

(PS - In case someone else has a similar issue and wants to draw on this
pattern, I think there's a quotation mark needed - I've added a quote
immediately after the 4th right hand field delimiter from the end. Without
it I lost some of my postcodes.)

"Doug Robbins - Word MVP" wrote:

Use the following field construction

{ IF { MERGEFIELD Suburb } "" "{ IF { MERGEFIELD City } "" "{
MERGEFIELD Suburb }¶
{ MERGEFIELD City } { MERGEFIELD PostCode }" "{ MERGEFIELD Suburb } {
MERGEFIELD PostCode }" } "{ MERGEFIELD City } {MERGEFIELD PostCode }" }

Where the ¶ appears in the above, press Enter (or Shift+Enter)

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

--
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, originally posted via msnews.microsoft.com

"Peter" wrote in message
...
I’m newly working at the NZ affiliate of an international charitable
organisation. The database currently used is fairly old and some fields
were
never perfectly consistent with our local situation. So over the years
data
entry has been inconsistent. Medium term goal is a new international
database and cleansed data, but in the meantime I would appreciate coding
ideas for a specific scenario.

For addresses in all correspondence the field layout should include:

Suburb (if not null)
City Postcode

Where Suburb and City both have values, the data entry is consistent.
But where Suburb is blank (eg for a small rural town) the City value
may
have been typed into the Suburb or City field. In such a case the
alternate field will then be null.

So I need a set of conditional field merges that cover (I think) three
possibilities:

Suburb
City Postcode

or
City Postcode (if Suburb is Null)

or
Suburb Postcode (if City is Null)

I can do bits of this but am having trouble with the layout needing to be
on
one or two lines. I presume I need to insert a line break or equivalent
but
don’t know how to code this.

Thanks in advance for any help.

Peter.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.