Mail Merge Alphanumeric Comparison Error

MS Word mail merge rules seem unable to distinguish alphanumerics when the compared item leads with a numeral, e.g.:

Rule:      {skipif {mergefield "TRANS"} <> "351A"
Record:  TRANS = 351B
Result:    Record is NOT SKIPPED (but should be skipped[/b] because "351A" <> "351B")

but the following generates the correct result:

Rule:      {skipif {mergefield "TRANS"} <> "A351"
Record:  TRANS = 351B
Result:    Record IS SKIPPED

It seems to ignore characters after the last numeral, e.g.:

Rule:      {skipif {mergefield "TRANS"} <> "351"
Record:  TRANS = 351B
Result:    Record is NOT SKIPPED (but should be skipped[/b] because "351" <> "351B"

Is there some kind of fix for this?
V MAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GrahamSkanRetiredCommented:
Sorry to have neglected this for so long. Put quotes around the merge field so that it is treated as a text rather than numeric.
{skipif "{mergefield "TRANS"}" <> "351A"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
V MAuthor Commented:
GrahamSkan, thank you!
0
V MAuthor Commented:
May I ask a related follow-up?

In simply trying to have my MS Word file draw data from a record in an Excel file,

I get the correct result when the data is numeric:

Rule:      {mergefield EXHIBIT_ID}
Record:  EXHIBIT_ID = 906
Result:    906

but, I get the incorrect result when the data is alphanumeric:

Rule:      {mergefield EXHIBIT_ID}
Record:  EXHIBIT_ID = 906A
Result:    0

I tried various combinations of  quotes ("s) to no avail.
0
V MAuthor Commented:
I found answer to my second question:

The problem was that MS Word MERGEFIELD function was not returning the alphanumeric data from the record.  This apparently was caused b the fact that the field from the underlying data file (Excel file) contained mixed data, i.e., some record had numeric data in that field, and some records had alphanumeric data in that field.  This apparently causes Word to treat the alphanumeric data  as zeroes.

SOLUTION: enter alphanumeric data in the FIRST RECORD in that data field.

https://social.msdn.microsoft.com/Forums/en-US/102c5fde-85ef-451e-8e68-181f329194d7/word-mail-merge-enters-quot0quot-zero-instead-of-text-into-merged-table-field
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.