Suppress Blank Data

J

John B

I am putting together a mail merge from access consisting of names and
address'. Included in the name is middle name. The field name for middle name
is mname. I would like to suppress the mname field every time that there is
no data in that field. I know how to suppress blank data in access, but do
not know how in word. I tried the same format from access, but it did not
work. The reason I am doing this through word, instead of access, is that I
have to rotate the font 90 degrees to go on the label.
Thanks.

John
 
P

Peter Jamieson

The problem isn't usually suppressing the field, but ensuring that the blank
space you need when the field has something in it is not there when the
field is empty.

e.g. suppose you have

{ MERGEFIELD firstname } { MERGEFIELD middlename } { MERGEFIELD lastname }

If firstname is Peter and lastname is Jamieson, but middlename is blank, you
will get

Peter Jamieson

(i.e. with two spaces between the names).

To suppress that you can for example
a. use the \b switch in the MERGEFIELD field in Word 2002 and later to
insert the necessary spaces, e.g.

{ MERGEFIELD firstname }{ MERGEFIELD middlename \b " " }{ MERGEFIELD
lastname \b " " }

b. use nested IF fields, e.g.

{ MERGEFIELD firstname
}{ IF "{ MERGEFIELD middlename }" = "" "" " { MERGEFIELD middlename }"
}{ IF "{ MERGEFIELD lastname }" = "" "" " { MERGEFIELD lastname }" }

c. create an Access query that returns exactly the string you want,
typically using iif functions to insert additional space when the related
field is non-blank, then use that as the data source for the merge. If you
are more familiar with the Access query language than the Word field
language, there's a lot to be said for constructing the entire address that
way.

NB, all the {} need to be the special field codes you can insert using
ctrl-F9, not the ordinary keyboard characters.

Peter Jamieson
 
J

John B

Peter,

Thanks for this info. It worked like a charm. I have done plenty of
query's in access, but I never gave it a thought about doing this there. Your
information will be useful doing other mail merges from excel and other types
of txt or csv's. Thanks again.

John
 

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