Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Word "If-then-else" Field

Geek News

Word "If-then-else" Field
Michelle Craig 4/25/2007 8:56:00 PM
Hi,

I'm trying to create a mail merge document that will display information for
a particular academic area based on three criteria that are in the data
source. One is degree (ADEG1), one is College (ACOL1) and one is Major Code
(MAJ1_CODE). I have been trying to nest the IF statements to look at all
three fields, but I can only get it to the point where it will look at two of
the fields. If anyone has made an IF work with more than two fields, would
you let me know? The code that works is below. Where I'm getting stuck is
adding in the third field. No matter what I've tried, it throws a field
calculation error when I try to run the merge. I'd really appreciate any help
you might be able to provide.

{ IF { = AND ( { COMPARE {MERGEFIELD ACOL1="Graduate School of Management"
}, {COMPARE {MERGEFIELD AMAJ1_CODE } = "BU-MBA" } ) } = 1 "Contact Name" "" }

If you know of a different way to nest IF statements and can provide an
example, that would be fantastic. I've tried looking on line and in MS Online
help, but this is the best I can locate.

Thanks so much,
--
Michelle Craig
Kent State University
mcraig0[ at ]kent.edu
Re: Word "If-then-else" Field
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 4/25/2007 10:45:57 PM

I think you need:

{ IF "{ MERGEFIELD ACOL1 }" = "Graduate School of Management"
"{ IF "{ MERGEFIELD AMAJ1_CODE }" = "BU-MBA"
"Contact Name" "" } "" }

You can probably ditch the "" around the { MERGEFIELD } fields.

Peter Jamieson

"Michelle Craig" <MichelleCraig[ at ]discussions.microsoft.com> wrote in message
news:C03FD20F-9694-4211-A424-EB5E236F7522[ at ]microsoft.com...
[Quoted Text]
> Hi,
>
> I'm trying to create a mail merge document that will display information
> for
> a particular academic area based on three criteria that are in the data
> source. One is degree (ADEG1), one is College (ACOL1) and one is Major
> Code
> (MAJ1_CODE). I have been trying to nest the IF statements to look at all
> three fields, but I can only get it to the point where it will look at two
> of
> the fields. If anyone has made an IF work with more than two fields, would
> you let me know? The code that works is below. Where I'm getting stuck is
> adding in the third field. No matter what I've tried, it throws a field
> calculation error when I try to run the merge. I'd really appreciate any
> help
> you might be able to provide.
>
> { IF { = AND ( { COMPARE {MERGEFIELD ACOL1="Graduate School of Management"
> }, {COMPARE {MERGEFIELD AMAJ1_CODE } = "BU-MBA" } ) } = 1 "Contact Name"
> "" }
>
> If you know of a different way to nest IF statements and can provide an
> example, that would be fantastic. I've tried looking on line and in MS
> Online
> help, but this is the best I can locate.
>
> Thanks so much,
> --
> Michelle Craig
> Kent State University
> mcraig0[ at ]kent.edu


Re: Word "If-then-else" Field
Michelle Craig 4/26/2007 4:06:06 PM
Peter,

Thanks so much for pointing me in the right direction. I was able to get it
to work with three nested IFs. It worked great. The code ended up as follows:

{ IF "{ MERGEFIELD ACOL1 }" = "Graduate School of Management"
"{ IF "{ MERGEFIELD AMAJ1_CODE }" = "BU-MBA"
"{IF "{MERGEFIELD ADEG1}" = "MBA" "Contact Name" } "" } "" }
--
Michelle Craig
Kent State University


"Peter Jamieson" wrote:

[Quoted Text]
>
> I think you need:
>
> { IF "{ MERGEFIELD ACOL1 }" = "Graduate School of Management"
> "{ IF "{ MERGEFIELD AMAJ1_CODE }" = "BU-MBA"
> "Contact Name" "" } "" }
>
> You can probably ditch the "" around the { MERGEFIELD } fields.
>
> Peter Jamieson
>
> "Michelle Craig" <MichelleCraig[ at ]discussions.microsoft.com> wrote in message
> news:C03FD20F-9694-4211-A424-EB5E236F7522[ at ]microsoft.com...
> > Hi,
> >
> > I'm trying to create a mail merge document that will display information
> > for
> > a particular academic area based on three criteria that are in the data
> > source. One is degree (ADEG1), one is College (ACOL1) and one is Major
> > Code
> > (MAJ1_CODE). I have been trying to nest the IF statements to look at all
> > three fields, but I can only get it to the point where it will look at two
> > of
> > the fields. If anyone has made an IF work with more than two fields, would
> > you let me know? The code that works is below. Where I'm getting stuck is
> > adding in the third field. No matter what I've tried, it throws a field
> > calculation error when I try to run the merge. I'd really appreciate any
> > help
> > you might be able to provide.
> >
> > { IF { = AND ( { COMPARE {MERGEFIELD ACOL1="Graduate School of Management"
> > }, {COMPARE {MERGEFIELD AMAJ1_CODE } = "BU-MBA" } ) } = 1 "Contact Name"
> > "" }
> >
> > If you know of a different way to nest IF statements and can provide an
> > example, that would be fantastic. I've tried looking on line and in MS
> > Online
> > help, but this is the best I can locate.
> >
> > Thanks so much,
> > --
> > Michelle Craig
> > Kent State University
> > mcraig0[ at ]kent.edu
>
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net