Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] GreenEnvy22@gmail.com is offline
external usenet poster
 
Posts: 2
Default If Then Else with mail merge faulty logic?

I have a situation where depending on a code from the data source, we
want to insert different text.

I'm having an issue where it seems Words If statement has a flaw. This
is all office 2003 pro.

Here is the line of code:
{If {MERGEFIELD APPEAL } = 90FR12345 "Matches" "Does Not Match"}

And with the code hidden for the appeal field so you can actually see
it:
{If 90CN98765 = 90FR12345 "Matches" "Does Not Match"}

The issue is that it will display "Matches" every time. The example
above clearly should display "Does Not Match". The problem, as near as
I can tell, is that Word can't handle the change from numbers to
letters. All it sees is 90 for both, so it works.
If I change the condition to say 91FR12345 it will then say "Does Not
Match"

I've tried putting quotes around the condition (Word does this
automatically if I use the Add-Field-If..Then..Else function, but
that also does not work.

Anyone have any suggestions to try here? I also would be willing to do
this via VBa, but as far as I can tell I can't access the mail merge
fields from VBa.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] GreenEnvy22@gmail.com is offline
external usenet poster
 
Posts: 2
Default If Then Else with mail merge faulty logic?

On Sep 11, 11:51 am, wrote:
I have a situation where depending on a code from the data source, we
want to insert different text.

I'm having an issue where it seems Words If statement has a flaw. This
is all office 2003 pro.

Here is the line of code:
{If {MERGEFIELD APPEAL } = 90FR12345 "Matches" "Does Not Match"}

And with the code hidden for the appeal field so you can actually see
it:
{If 90CN98765 = 90FR12345 "Matches" "Does Not Match"}

The issue is that it will display "Matches" every time. The example
above clearly should display "Does Not Match". The problem, as near as
I can tell, is that Word can't handle the change from numbers to
letters. All it sees is 90 for both, so it works.
If I change the condition to say 91FR12345 it will then say "Does Not
Match"

I've tried putting quotes around the condition (Word does this
automatically if I use the Add-Field-If..Then..Else function, but
that also does not work.

Anyone have any suggestions to try here? I also would be willing to do
this via VBa, but as far as I can tell I can't access the mail merge
fields from VBa.


I solved my own issue. The problem was Word was assuming the field was
all numeric, so as soon as it encountered a non number it quit.
To solve this, I changed the line to the following:

{If {MERGEFIELD APPEAL \b } = 90FR12345 "Matches" "Does Not Match"}

This works, as Word now treats it as text, not a number.



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
faulty save biochemanya Microsoft Word Help 2 February 10th 07 07:51 AM
Word 2004 for Mac has faulty document merge [email protected] Microsoft Word Help 0 January 17th 06 09:03 PM
Go To [Page Number] Logic? Paul Formatting Long Documents 6 November 27th 05 11:46 PM
Check Box Logic Eleanor Mailmerge 1 September 22nd 05 09:40 PM
Fuzzy logic matching in a DLL Dave Williams Microsoft Word Help 3 March 23rd 05 04:52 AM


All times are GMT +1. The time now is 07:16 AM.

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"