One Letter Names in Salutation

D

Dale

Hi All, I am resending this as I think I posted it in the wrong group
previously.


I do a lot of mail merges using MS Word. I've dealt some with field codes
and macros but this situation stumps me. Is there a way/how would I deal
with one letter first names in a salutation. For instance, if I'm trying to
use the first name field of an individual from my data but the first and
last name looks like "D Jones" then the resulting salutation would be "Dear
D". Obviously this is not good. I would think the answer lies in proper
use of the If-Then-Else style Word Field. Therein lies my problem. How to
build an IF statement from looking at my data and deciding whether or not
the data is only one character long.

Can someone suggest how this may be done? I surmise possibly a Word
"compare" field might do but again, syntax gets in my way.

Help!

Regards
Dale
 
P

Peter Jamieson

You can test using e.g.

{ IF "{ MERGEFIELD myfield }" = "?" "one letter" "not one letter" }

because "?" is a wildcard that detects a single letter. Notice that "" will
also result in "not one letter". Beyond that, it is a question of exactly
what you need - for example, if you have a Title field you might use

Dear { IF "{ MERGEFIELD firstname }" = "?" "{ MERGEFIELD title } {
MERGEFIELD lastname }"
"{ MERGEFIELD firstname }" }

and so on. All the {} need to be the sort you can enter using ctrl-F9.

Peter Jamieson
 
D

Dale

Thanx Peter.

Syntax is everything.

I was aware of the ? as a wildcard from DOS days but it never occurred to
me. I think I'll combine this with COMPARE to check and see if the field is
also empty. If empty then I usually have the data clean enough to do
something like "Dear Mr Jones"

I appreciate the help.
 
B

betwalk

There is also the issue of the data itself. Which may not be your
answer for this moment in time, but any database I handle that will be
used for mailings has a "salutation" field to avoid exactly this kind
of coding. The more you have to code to look for anomalies, the more
there is chance for undesired results. For example, very often the
data recorded in the first name field will be appropriate for a mailing
label, but something more familiar might be desired for the salutation.
I see this all the time with the organizations I work with. I realize
that right now you have to produce results with the data that you have,
but planning your table structures and data collection methods to
include this can really help in the future.

Betsy
 

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