If -Then-Else Statements in Word 2003

B

bxgti4x4

I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.

I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field is
blank but the PostCode field contains data but when I merge the data,
the whole line is blanked out.

I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.

What I want to say is - [If County = "" show Post Code else County and
PostCode]

Could someone please advise how I should format this line and make it
stay there.

Thanks and Regards
John
 
D

Doug Robbins - Word MVP

{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country } { MERGEFIELD PostCode }" }

You must use Ctrl+F9 to insert each pair of field delimiters and 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
 
G

Graham Mayor

{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield County}
{Mergefield PostCode}"}

Each pair of field boundaries {} is inserted with CTRL+F9. Type the rest.
ALT+F9 to toggle the display.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

bxgti4x4

Thanks Graham and Doug,

That did the trick, I think I was not closing the entry with Alt F9

Thanks for your help.

Best Regards
John

{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield County}
{Mergefield PostCode}"}

Each pair of field boundaries {} is inserted with CTRL+F9. Type the rest.
ALT+F9 to toggle the display.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.
I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field is
blank but the PostCode field contains data but when I merge the data,
the whole line is blanked out.
I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.
What I want to say is - [If County = "" show Post Code else County and
PostCode]
Could someone please advise how I should format this line and make it
stay there.
Thanks and Regards
John- Hide quoted text -

- Show quoted text -
 
B

bxgti4x4

Hello Again,

I have been woking on the field but am finding the following problems:

1 No matter what I do, I end up with a space before the text is
printed. How do I get rid of this?
2 I wish to put two spaces between County and PostCode but, again,
no matter how many spaces I enter into the code, I still end up with
only one between the two parts of the text. How do I space the two
part out?

So near and yet so far!

Best Regards
John

Thanks Graham and Doug,

That did the trick, I think I was not closing the entry with Alt F9

Thanks for your help.

Best Regards
John

{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield County}
{Mergefield PostCode}"}
Each pair of field boundaries {} is inserted with CTRL+F9. Type the rest.
ALT+F9 to toggle the display.
My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
bxgti4x4 said:
I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.
I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field is
blank but the PostCode field contains data but when I merge the data,
the whole line is blanked out.
I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.
What I want to say is - [If County = "" show Post Code else County and
PostCode]
Could someone please advise how I should format this line and make it
stay there.
Thanks and Regards
John- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
D

Doug Robbins - Word MVP

{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country }[ ]{ MERGEFIELD PostCode }" }

If you have two spaces in place of the [ ] above, that is what you will
get.

You should not have { MERGEFIELD Country } anywhere else in the document
except where it appears in the above construction.
--
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

bxgti4x4 said:
Hello Again,

I have been woking on the field but am finding the following problems:

1 No matter what I do, I end up with a space before the text is
printed. How do I get rid of this?
2 I wish to put two spaces between County and PostCode but, again,
no matter how many spaces I enter into the code, I still end up with
only one between the two parts of the text. How do I space the two
part out?

So near and yet so far!

Best Regards
John

Thanks Graham and Doug,

That did the trick, I think I was not closing the entry with Alt F9

Thanks for your help.

Best Regards
John

{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield
County}
{Mergefield PostCode}"}
Each pair of field boundaries {} is inserted with CTRL+F9. Type the
rest.
ALT+F9 to toggle the display.
My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
bxgti4x4 wrote:
I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.
I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field
is
blank but the PostCode field contains data but when I merge the
data,
the whole line is blanked out.
I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.
What I want to say is - [If County = "" show Post Code else County
and
PostCode]
Could someone please advise how I should format this line and make it
stay there.
Thanks and Regards
John- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
B

bxgti4x4

Thanks Doug, that worked OK. It was odd, I tried it before and it
didn't work - hence my previous post. Not sure what changed but all
is well.

Thanks very much for your help.

Best Regards
John

{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country }[ ]{ MERGEFIELD PostCode }" }

If you have two spaces in place of the [ ] above, that is what you will
get.

You should not have { MERGEFIELD Country } anywhere else in the document
except where it appears in the above construction.
--
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




Hello Again,
I have been woking on the field but am finding the following problems:
1 No matter what I do, I end up with a space before the text is
printed. How do I get rid of this?
2 I wish to put two spaces between County and PostCode but, again,
no matter how many spaces I enter into the code, I still end up with
only one between the two parts of the text. How do I space the two
part out?
So near and yet so far!
Best Regards
John
Thanks Graham and Doug,
That did the trick, I think I was not closing the entry with Alt F9
Thanks for your help.
Best Regards
John
{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield
County}
{Mergefield PostCode}"}
Each pair of field boundaries {} is inserted with CTRL+F9. Type the
rest.
ALT+F9 to toggle the display.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
bxgti4x4 wrote:
I have been reading all the posts regarding the use of Word Fields to
skip a field if the data is blank but I'm still having problems.
I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field
is
blank but the PostCode field contains data but when I merge the
data,
the whole line is blanked out.
I have tried using the If-Then-Else statement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.
What I want to say is - [If County = "" show Post Code else County
and
PostCode]
Could someone please advise how I should format this line and make it
stay there.
Thanks and Regards
John- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
J

john

Thanks Doug, that worked OK. It was odd, I tried it before and it
didn't work - hence my previous post. Not sure what changed but all
is well.

Thanks very much for your help.

Best Regards
John

{ IF { MERGEFIELD Country } = "" { MERGEFIELD PostCode } "{ MERGEFIELD
Country }[ ]{ MERGEFIELD PostCode }" }
If you have two spaces in place of the [ ] above, that is what you will
get.
You should not have { MERGEFIELD Country } anywhere else in the document
except where it appears in the above construction.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins -WordMVP
Hello Again,
I have been woking on the field but am finding the following problems:
1 No matter what I do, I end up with a space before the text is
printed. How do I get rid of this?
2 I wish to put two spaces between County and PostCode but, again,
no matter how many spaces I enter into the code, I still end up with
only one between the two parts of the text. How do I space the two
part out?
So near and yet so far!
Best Regards
John
Thanks Graham and Doug,
That did the trick, I think I was not closing the entry with Alt F9
Thanks for your help.
Best Regards
John
{IF{Mergefield County} = "" "{Mergefield PostCode}" "{Mergefield
County}
{Mergefield PostCode}"}
Each pair of field boundaries {} is inserted with CTRL+F9. Type the
rest.
ALT+F9 to toggle the display.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - WordMVP
My web sitewww.gmayor.com
WordMVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
bxgti4x4 wrote:
I have been reading all the posts regarding the use ofWordFields to
skip a field if the data is blank but I'm still having problems.
I have two Mergefields on the same line <<County>> and <<PostCode>>.
In some cases, like sending a letter to Australia, the County field
is
blank but the PostCode field contains data but when I merge the
data,
the whole line is blanked out.
I have tried using theIf-Then-Elsestatement as advised in various
posts but I cannot save the revised field. AlI I end up with is the
original mergefield.
What I want to say is - [If County = "" show Post Code else County
and
PostCode]
I've hit another problem with this code.

Normally, if a field is blank, the line does not print and the
remainder of the address closes up. However in the line which
contains the code, if the both "County" and "Post Code" are blank, the
line remains, so I get a blank line between "Town" and "Country".

I've tried using a second "If" statement but it makes no difference.
Could someone please advise how I can get rid of the blank line.

Thanks a lot
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top