Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
DonnaRae DonnaRae is offline
external usenet poster
 
Posts: 2
Default how to make multiple "if...then...else" fields

{IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
salesperson info"}

How do I add more "ifs" to this? I need to add about 20 states, and the
alternate text is always "company salesperson info". Does that have to go at
the end of each "if", or will it work if it is placed just at the end of all
the "ifs"?

Thanks,

Donna
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default how to make multiple "if...then...else" fields

It depends.

First, it's generally easier to see what's going on if you use alt-F9 to
toggle between "field display" and "field results display", and use ctrl-F9
to insert each pair of the special field code braces {}.

If state = MA
then "mass distributor contact info for MA"
else "company salesperson info for MA"

then I suggest you use something like

{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"company salesperson info for MA"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"company salesperson info for NY"
}

and so on for each state.

If what you need is

If state = MA
then "mass distributor contact info for MA"
else if state = "NY"
then "mass distributor contact info for NY"
etc. and if state isn't any of those 20 states , then
"company salesperson info"

then you could try something like

{ SET cspi "N"
}{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"{ SET cspi "Y" }"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"{ SET cspi "Y" }"
}{ IF cspi = "N"
""
"company salesperson info" }

Each pair of () needs to be the field code braces you can isert using
ctrl-F9.

I have a feeling I haven't quite got that right but have a go and see what
happens.

Peter Jamieson


"DonnaRae" wrote in message
...
{IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
salesperson info"}

How do I add more "ifs" to this? I need to add about 20 states, and the
alternate text is always "company salesperson info". Does that have to go
at
the end of each "if", or will it work if it is placed just at the end of
all
the "ifs"?

Thanks,

Donna



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
DonnaRae DonnaRae is offline
external usenet poster
 
Posts: 2
Default how to make multiple "if...then...else" fields

The second option that you gave is what I need, but I don't understand it.
{ SET cspi "N -- What does that mean?

Donna

"Peter Jamieson" wrote:

It depends.

First, it's generally easier to see what's going on if you use alt-F9 to
toggle between "field display" and "field results display", and use ctrl-F9
to insert each pair of the special field code braces {}.

If state = MA
then "mass distributor contact info for MA"
else "company salesperson info for MA"

then I suggest you use something like

{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"company salesperson info for MA"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"company salesperson info for NY"
}

and so on for each state.

If what you need is

If state = MA
then "mass distributor contact info for MA"
else if state = "NY"
then "mass distributor contact info for NY"
etc. and if state isn't any of those 20 states , then
"company salesperson info"

then you could try something like

{ SET cspi "N"
}{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"{ SET cspi "Y" }"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"{ SET cspi "Y" }"
}{ IF cspi = "N"
""
"company salesperson info" }

Each pair of () needs to be the field code braces you can isert using
ctrl-F9.

I have a feeling I haven't quite got that right but have a go and see what
happens.

Peter Jamieson


"DonnaRae" wrote in message
...
{IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
salesperson info"}

How do I add more "ifs" to this? I need to add about 20 states, and the
alternate text is always "company salesperson info". Does that have to go
at
the end of each "if", or will it work if it is placed just at the end of
all
the "ifs"?

Thanks,

Donna




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default how to make multiple "if...then...else" fields

cspi is just a variable name (in fact, it's a Word "bookmark" name) I
invented. It stands for "company sales person info". You can use any valid
bookmark name (more or less).

A { SET } field assigns a value to a bookmark/variable. You can then access
the value using

{ REF cspi }

or

{ cspi }

But there's an error at the end of my suggestion. It should be

{ IF "{ REF cspi }" = "N"
""
"company salesperson info" }

Peter Jamieson
"DonnaRae" wrote in message
news
The second option that you gave is what I need, but I don't understand it.
{ SET cspi "N -- What does that mean?

Donna

"Peter Jamieson" wrote:

It depends.

First, it's generally easier to see what's going on if you use alt-F9 to
toggle between "field display" and "field results display", and use
ctrl-F9
to insert each pair of the special field code braces {}.

If state = MA
then "mass distributor contact info for MA"
else "company salesperson info for MA"

then I suggest you use something like

{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"company salesperson info for MA"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"company salesperson info for NY"
}

and so on for each state.

If what you need is

If state = MA
then "mass distributor contact info for MA"
else if state = "NY"
then "mass distributor contact info for NY"
etc. and if state isn't any of those 20 states , then
"company salesperson info"

then you could try something like

{ SET cspi "N"
}{ IF "{ MERGEFIELD state }" = "MA"
"mass distributor contact info for MA"
"{ SET cspi "Y" }"
}{ IF "{ MERGEFIELD state }" = "NY"
"mass distributor contact info for NY"
"{ SET cspi "Y" }"
}{ IF cspi = "N"
""
"company salesperson info" }

Each pair of () needs to be the field code braces you can isert using
ctrl-F9.

I have a feeling I haven't quite got that right but have a go and see
what
happens.

Peter Jamieson


"DonnaRae" wrote in message
...
{IF {MERGEFIELD State} = "MA" "mass distributor contact info" "company
salesperson info"}

How do I add more "ifs" to this? I need to add about 20 states, and the
alternate text is always "company salesperson info". Does that have to
go
at
the end of each "if", or will it work if it is placed just at the end
of
all
the "ifs"?

Thanks,

Donna






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
MULTIPLE INSTANCES OF THE SAME BOOKMARK IN A USER FORM Carol Microsoft Word Help 20 October 3rd 06 12:41 AM
Make multiple name labels using Word & Avery 8660. No database, me Truly Retired Microsoft Word Help 2 May 26th 05 05:42 AM
How do I make forms that allows free response across multiple line Frustrated Therapist Microsoft Word Help 1 May 14th 05 05:04 AM
How do I make multiple entry labels in word 2003? Roget Microsoft Word Help 1 February 17th 05 04:44 AM
How do you make fields in a template and keep your field label fr. Dee Microsoft Word Help 1 February 17th 05 12:15 AM


All times are GMT +1. The time now is 05:25 PM.

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"