Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] clive.ming@hotmail.co.uk is offline
external usenet poster
 
Posts: 5
Default Mail merge .. . If Then Else

Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason doesnt
work and even when the condition is met it does not print @. As part
of the testing i have printed to screen Value X to confirm it contains
the data for the condition to be met but it doesnt write the @.

{ IF { MERGEFIELD PatientCode } = "XX" "@" "" }

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] clive.ming@hotmail.co.uk is offline
external usenet poster
 
Posts: 5
Default Mail merge .. . If Then Else

On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason doesnt
work and even when the condition is met it does not print @. As part
of the testing i have printed to screen Value X to confirm it contains
the data for the condition to be met but it doesnt write the @.

{ IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge .. . If Then Else

1. Are all the {} the special field code braces that you can insert using
ctrl-F9?
2. Is the value definitely XX and not xx, xX etc?
3. Try adding double quotes around the { MERGEFIELD } field, i.e.

{ IF "{ MERGEFIELD PatientCode }" = "XX" "@" "" }

Peter Jamieson
wrote in message
oups.com...
On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason doesnt
work and even when the condition is met it does not print @. As part
of the testing i have printed to screen Value X to confirm it contains
the data for the condition to be met but it doesnt write the @.

{ IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Mail merge .. . If Then Else

And do test the result of {Mergefield PatientCode} without a condition to
ensure it reproduces exactly what you think it should reproduce. Try also

{ IF { MERGEFIELD PatientCode \*Upper} = "XX" "@" }
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Peter Jamieson wrote:
1. Are all the {} the special field code braces that you can insert
using ctrl-F9?
2. Is the value definitely XX and not xx, xX etc?
3. Try adding double quotes around the { MERGEFIELD } field, i.e.

{ IF "{ MERGEFIELD PatientCode }" = "XX" "@" "" }

Peter Jamieson
wrote in message
oups.com...
On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason
doesnt work and even when the condition is met it does not print @.
As part of the testing i have printed to screen Value X to confirm
it contains the data for the condition to be met but it doesnt
write the @. { IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] clive.ming@hotmail.co.uk is offline
external usenet poster
 
Posts: 5
Default Mail merge .. . If Then Else

On 8 Feb, 16:15, "Graham Mayor" wrote:
And do test the result of {Mergefield PatientCode} without a condition to
ensure it reproduces exactly what you think it should reproduce. Try also

{ IF { MERGEFIELD PatientCode \*Upper} = "XX" "@" }
--

Graham Mayor - Word MVP

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




Peter Jamieson wrote:
1. Are all the {} the special field code braces that you can insert
using ctrl-F9?
2. Is the value definitely XX and not xx, xX etc?
3. Try adding double quotes around the { MERGEFIELD } field, i.e.


{ IF "{ MERGEFIELD PatientCode }" = "XX" "@" "" }


Peter Jamieson
wrote in message
roups.com...
On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason
doesnt work and even when the condition is met it does not print @.
As part of the testing i have printed to screen Value X to confirm
it contains the data for the condition to be met but it doesnt
write the @. { IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.- Hide quoted text -


- Show quoted text -


Hi - thanks for your suggestions - i cant try them at the moment as
production is down . With regards word mail merge i dont have any
exeperience apart from the hour or so that i have spent looking at
this issue (although i have numerous years of development experience -
somewhat offset by the fact i am now a manager ).

In one of the suggestions the code used \*Upper - i pressume that
there must be numerous other switches e.g. \*Lower etc. Is there a FAQ
that describes all these 'switches' - cant seem to find mention of
them Word Help.

Thanks in advance,

CM



  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge .. . If Then Else

They are in Word Help - if you can get to the table of contents in Word
2002/2003, look for

"Automating Tasks and Programmability"|"Field Types and Switches", then for
this specific topic look for "Field Reference"|"Switches" and for \*Upper
etc., "Format (\*) field switch".

If you're on another version of Word, things may be different.

Peter Jamieson
wrote in message
ups.com...
On 8 Feb, 16:15, "Graham Mayor" wrote:
And do test the result of {Mergefield PatientCode} without a condition to
ensure it reproduces exactly what you think it should reproduce. Try also

{ IF { MERGEFIELD PatientCode \*Upper} = "XX" "@" }
--

Graham Mayor - Word MVP

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




Peter Jamieson wrote:
1. Are all the {} the special field code braces that you can insert
using ctrl-F9?
2. Is the value definitely XX and not xx, xX etc?
3. Try adding double quotes around the { MERGEFIELD } field, i.e.


{ IF "{ MERGEFIELD PatientCode }" = "XX" "@" "" }


Peter Jamieson
wrote in message
roups.com...
On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason
doesnt work and even when the condition is met it does not print @.
As part of the testing i have printed to screen Value X to confirm
it contains the data for the condition to be met but it doesnt
write the @. { IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.- Hide quoted text -


- Show quoted text -


Hi - thanks for your suggestions - i cant try them at the moment as
production is down . With regards word mail merge i dont have any
exeperience apart from the hour or so that i have spent looking at
this issue (although i have numerous years of development experience -
somewhat offset by the fact i am now a manager ).

In one of the suggestions the code used \*Upper - i pressume that
there must be numerous other switches e.g. \*Lower etc. Is there a FAQ
that describes all these 'switches' - cant seem to find mention of
them Word Help.

Thanks in advance,

CM



  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] clive.ming@hotmail.co.uk is offline
external usenet poster
 
Posts: 5
Default Mail merge .. . If Then Else

On 8 Feb, 16:55, wrote:
On 8 Feb, 16:15, "Graham Mayor" wrote:





And do test the result of {Mergefield PatientCode} without a condition to
ensure it reproduces exactly what you think it should reproduce. Try also


{ IF { MERGEFIELD PatientCode \*Upper} = "XX" "@" }
--

Graham Mayor - Word MVP


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


Peter Jamieson wrote:
1. Are all the {} the special field code braces that you can insert
using ctrl-F9?
2. Is the value definitely XX and not xx, xX etc?
3. Try adding double quotes around the { MERGEFIELD } field, i.e.


{ IF "{ MERGEFIELD PatientCode }" = "XX" "@" "" }


Peter Jamieson
wrote in message
roups.com...
On 8 Feb, 15:33, wrote:
Hi - i am having a few problems with the if then else conditional
statement with word mail merge. The logic that i am looking to
implement is if Value X = XX then print @ else print nothing. The
code is below. Now this seems very simple but for some reason
doesnt work and even when the condition is met it does not print @.
As part of the testing i have printed to screen Value X to confirm
it contains the data for the condition to be met but it doesnt
write the @. { IF { MERGEFIELD PatientCode } = "XX" "@" "" }


So the issue i have is that although the condition seems to have been
met it does not execute the correct part of the conditional
statement. The data being used for the mail merge comes from a SQL
2000 SP3a database.- Hide quoted text -


- Show quoted text -


Hi - thanks for your suggestions - i cant try them at the moment as
production is down . With regards word mail merge i dont have any
exeperience apart from the hour or so that i have spent looking at
this issue (although i have numerous years of development experience -
somewhat offset by the fact i am now a manager ).

In one of the suggestions the code used \*Upper - i pressume that
there must be numerous other switches e.g. \*Lower etc. Is there a FAQ
that describes all these 'switches' - cant seem to find mention of
them Word Help.

Thanks in advance,

CM- Hide quoted text -

- Show quoted text -



Hi - just tried the suggested fix and it still doesnt work - the code
is below;

{ IF "{ MERGEFIELD PatientCode \*Upper}" = "XX" "@" }

Any other suggestions - this is really frustrating because for all
intents and purposes it should work. I have tried using the same
logic with another merge field and it works fine - could there be
anything in particular with this field that might mean that the
condition is not being met?

Thanks in advance,

CM




  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Mail merge .. . If Then Else

wrote:

Is there a FAQ
that describes all these 'switches' - cant seem to find mention of
them Word Help.


See
http://www.gmayor.com/formatting_word_fields.htm which covers all the
switches and their use and demonstrates some more involved procedures also.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



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 crashes when I try to mail merge using Outlook recipients Medicalst Mailmerge 3 January 3rd 07 10:39 AM
Mail Merge insert merge fields Dannyl Mailmerge 1 December 12th 06 05:51 AM
Mail Merge Dannyl Mailmerge 0 December 12th 06 03:40 AM
Heavy Mail Merge Application Atul Mailmerge 1 August 17th 06 02:37 PM
How to get all mail merge fields in a document [email protected] Mailmerge 3 February 17th 06 05:43 AM


All times are GMT +1. The time now is 08:33 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"