Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JVRB JVRB is offline
external usenet poster
 
Posts: 1
Default Where can I find help using nested if...then fields in merge docs

I have an Excel spreadsheet I am using as a database (as it has less thatn
100 records, Excel is adequate). I have 3 types of mail targets - with
variations
1. Unmarried clients with and without middle initials
2. Married clients with shared surname, with and without middle initials
3. Married clients with different surnames, with and without middle initials

My field names are First_Name1, Mid_Init1, Last_Name1, First_Name2,
Mid_Init2, and Last_Name2.

I need to set up my mail merge such that it gives me:

First_Name1 Mid_Init1
If First_Name2 is blank,
return First_Name1 Mid_Init1 Last_Name1 (i.e. John J. Doe)
If First_Name2 is not blank and Last_Name2 is blank,
return First_Name1 Mid_Init1 and First_Name2 Mid_Init2 Last_Name1
(I.e. John J. and Jane K. Doe)
If Last_Name2 is not blank,
return First_Name1 Mid_Init1 Last_Name1 and First_Name2 Mid_Init2 Last_Name2

I tried using nested if combined with .AND. but it doesn't seem to work.

Anyone have an idea on this?

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Where can I find help using nested if...then fields in merge docs

Graham Mayor's page at

http://www.gmayor.com/formatting_word_fields.htm

has a section titled "Insert field information and associated text
conditionally" that shows how to construct this kind of thing.

In this case you probably need something like the following, assuming that
Mid_Init1 and Mid_Init2 could also be blank

{ MERGEFIELD First_Name1 }{ IF "{ MERGEFIELD Mid_Init1 }" = "" "" " {
MERGEFIELD Mid_Init1 }"
}{ IF "{ MERGEFIELD First_Name2 }" = ""
" { MERGEFIELD Last_Name1 )"
"{ IF "{ MERGEFIELD Last_Name2 }" = ""
" and { MERGEFIELD First_Name2 }{ IF "{ MERGEFIELD Mid_Init2 }" = "" ""
" { MERGEFIELD Mid_Init2 }"
} { MERGEFIELD Last_Name1 }"
" { MERGEFIELD Last_Name1 } and { MERGEFIELD First_Name2
}{ IF "{ MERGEFIELD Mid_Init2 }" = "" "" " { MERGEFIELD Mid_Init2 }"
} { MERGEFIELD Last_Name2 }" } }

The layout doesn't have to be the way i've show it (it's difficult to show
the structure well) but all the {} need to be the special field code braces
you can insert using ctrl-F9 and pay attention to the spacing!

You can sometimes simplify stuff in Word 2003 and maybe 2002 using \b and \f
switches to insert text before or following the field when it is non-blank,
e.g.

{ MERGEFIELD First_Name1 }{ MERGEFIELD Mid_Init1 \b " "
}{ IF "{ MERGEFIELD First_Name2 }" = ""
" { MERGEFIELD Last_Name1 )"
"{ IF "{ MERGEFIELD Last_Name2 }" = ""
" and { MERGEFIELD First_Name2 }{ MERGEFIELD Mid_Init2 \b " " } {
MERGEFIELD Last_Name1 }"
" { MERGEFIELD Last_Name1 } and { MERGEFIELD First_Name2
}{ MERGEFIELD Mid_Init2 \b " " } { MERGEFIELD Last_Name2 }" } }

Peter Jamieson

"JVRB" wrote in message
...
I have an Excel spreadsheet I am using as a database (as it has less thatn
100 records, Excel is adequate). I have 3 types of mail targets - with
variations
1. Unmarried clients with and without middle initials
2. Married clients with shared surname, with and without middle initials
3. Married clients with different surnames, with and without middle
initials

My field names are First_Name1, Mid_Init1, Last_Name1, First_Name2,
Mid_Init2, and Last_Name2.

I need to set up my mail merge such that it gives me:

First_Name1 Mid_Init1
If First_Name2 is blank,
return First_Name1 Mid_Init1 Last_Name1 (i.e. John J. Doe)
If First_Name2 is not blank and Last_Name2 is blank,
return First_Name1 Mid_Init1 and First_Name2 Mid_Init2 Last_Name1
(I.e. John J. and Jane K. Doe)
If Last_Name2 is not blank,
return First_Name1 Mid_Init1 Last_Name1 and First_Name2 Mid_Init2
Last_Name2

I tried using nested if combined with .AND. but it doesn't seem to work.

Anyone have an idea on this?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2003: Insert Merge Fields window pidossi Mailmerge 2 October 25th 06 06:56 AM
MS Word form fields versus mail merge fields [email protected] Mailmerge 4 March 4th 06 05:31 PM
Form fields versus mail merge fields [email protected] Microsoft Word Help 2 February 16th 06 02:12 PM
Can't find locked fields Ron Ford Mailmerge 0 December 20th 04 05:57 PM
Using MAILMERGE fields within HYPERLINK fields for Merge to Email Mark V Mailmerge 2 December 4th 04 04:01 PM


All times are GMT +1. The time now is 06:50 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"