Help!

If -Then-Else Statements in Word 2003

 
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> MailMerge Fields RSS
Next:  Word 2003 was unable to open the data source file..  
Author Message
bxgti4x4
External


Since: Mar 01, 2007
Posts: 4



PostPosted: Thu Mar 01, 2007 12:01 pm    Post subject: If -Then-Else Statements in Word 2003
Archived from groups: microsoft>public>word>mailmerge>fields (more info?)

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
Back to top
bxgti4x4
External


Since: Mar 01, 2007
Posts: 4



PostPosted: Thu Mar 01, 2007 1:36 pm    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

On Mar 1, 3:25 pm, "Graham Mayor" wrote:
> {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 -
Back to top
bxgti4x4
External


Since: Mar 01, 2007
Posts: 4



PostPosted: Thu Mar 01, 2007 1:54 pm    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

On Mar 1, 4:36 pm, "bxgti4x4" wrote:
> 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
>
> On Mar 1, 3:25 pm, "Graham Mayor" wrote:
>
>
>
> > {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 -
Back to top
Doug Robbins - Word MVP
External


Since: Jul 14, 2006
Posts: 2843



PostPosted: Thu Mar 01, 2007 9:21 pm    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

{ 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

"bxgti4x4" wrote in message

>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
>
Back to top
Graham Mayor
External


Since: Jul 04, 2006
Posts: 4874



PostPosted: Thu Mar 01, 2007 10:25 pm    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

{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 site www.gmayor.com
Word MVP web site http://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
Back to top
Doug Robbins - Word MVP
External


Since: Jul 14, 2006
Posts: 2843



PostPosted: Fri Mar 02, 2007 3:25 am    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

{ 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" wrote in message

> 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
>
> On Mar 1, 4:36 pm, "bxgti4x4" wrote:
>> 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
>>
>> On Mar 1, 3:25 pm, "Graham Mayor" wrote:
>>
>>
>>
>> > {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 -
>
>
Back to top
bxgti4x4
External


Since: Mar 01, 2007
Posts: 4



PostPosted: Fri Mar 02, 2007 6:37 am    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

On Mar 1, 9:25 pm, "Doug Robbins - Word MVP"
wrote:
> { 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" wrote in message
>
>
>
>
>
> > 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
>
> > On Mar 1, 4:36 pm, "bxgti4x4" wrote:
> >> 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
>
> >> On Mar 1, 3:25 pm, "Graham Mayor" wrote:
>
> >> > {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 -
Back to top
john
External


Since: Mar 16, 2007
Posts: 5



PostPosted: Fri Mar 16, 2007 7:10 am    Post subject: Re: If -Then-Else Statements in Word 2003 [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mar 2, 9:37 am, "bxgti4x4" wrote:
> 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
>
> On Mar 1, 9:25 pm, "Doug Robbins -WordMVP"
> wrote:
>
>
>
> > { 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 -WordMVP
>
> > "bxgti4x4" wrote in message
>
> >
>
> > > 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
>
> > > On Mar 1, 4:36 pm, "bxgti4x4" wrote:
> > >> 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
>
> > >> On Mar 1, 3:25 pm, "Graham Mayor" wrote:
>
> > >> > {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

> > >> > > 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 -- Hide quoted text -
>
> - Show quoted text -
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> MailMerge Fields All times are: Eastern Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum