View Single Post
  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
emc emc is offline
external usenet poster
 
Posts: 9
Default I want to omit a field in a mail merge

Amazingly I did have it in the right place but didn't have two the extra "}.

Many thanks again for this. It has been a great help.

EMC

"Graham Mayor" wrote:

But where did you put the conditional field? It should be nested eg

{ IF{ Mergefield Prefix } "" "{ Mergefield Prefix } " }{ IF{ Mergefield
Prefix} "Lady" "{ IF{ Mergefield FirstName } "" "{ Mergefield
FirstName } "}" }{ Mergefield Surname }

--

Graham Mayor - Word MVP

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


emc wrote:
This is working a treat, however...

as some in the database do not have a Prefix or FirstName (don't ask)
they are addressed by their surname. I have tried to apply the logic
below by adding { IF{ Mergefield FirstName } "" "{ Mergefield
FirstName } " } but unfortunately when I do this it replicates the
FirstName.

EMC

"Graham Mayor" wrote:

It needs a slight reshuffle and an extra conditional:

{ IF{ Mergefield Prefix } "" "{ Mergefield Prefix } " }{ IF{
Mergefield Prefix} "Lady" "{ Mergefield FirstName } " }{
Mergefield Surname }

--

Graham Mayor - Word MVP

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


emc wrote:
Fantastic Graham, I have got it to work.

However, there is one slight tweak needed. As some of the entries
don't have a Prefix there is a space before their FirstName. Before
you showed me how to do this, in the Insert Word Field I had "If
Prefix is not blank" in the 'Insert this text' box I put a space and
a space was created. Where would I put this now?

EMC


"Graham Mayor" wrote:

Remove that AddressBlock field (display with ALT+F9)
Using CTRL+F9 for each pair of brackets {} enter the following

{Mergefield Prefix} {IF{Mergefield Prefix} "Lady" " {Mergefield
FirstName}"} {Mergefield Surname}

Note the space between the quotes and {Mergefield FirstName} and
the space before {Mergefield Surname}. The rest is all entered on
the same line (even if it appears broken in this post).
Your address fields can follow as required.
Press Alt+F9 to display the results and merge to a new document.

--

Graham Mayor - Word MVP

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


emc wrote:
In my Prefix I have Mr/Mrs/Miss/Sir/Lady, FirstName as you would
expect along with Surname. However, as several records have Lady
as the Prefix these must only be addressed with the Prefix and
Surname, ie they cannot be addressed as Lady Jane Brown, they
must be addressed as Lady[Prefix] Brown[Surname]. That's why I
would like the merge to omit the FirstName and only insert the
Prefix and Surname in the documentation.

I hope this explanation helps.

EMC

PS I tried the
http://www.gmayor.com/merge_labels_with_word_2007.htm link but it
isn't working.


"Graham Mayor" wrote:

A conditional (IF) field is one that inserts (or fails to insert)
information when the condition applies. The example I quoted
earlier {IF{Mergefield FirstName} "Fred" "{Mergefield
FirstName}"} inserts the FirstName field when the firstname is
anything other than Fred. You have not said what conditions apply
that you should omit the firstname.
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm or
http://www.gmayor.com/merge_labels_with_word_2007.htm should
give you some background to merges generally, but if you tell us
what the relevant fieldnames are and what conditions apply when
you wish to insert them, I'll tell you what to enter.
That data source is irrelevant. It is the fieldnames that matter
and how you want to display them.

--

Graham Mayor - Word MVP

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


emc wrote:
Graham,

Sorry - my head is full of mince today!

I'm afraid I'm not too clued up on mail merges and don't know
what a conditional field is. Can you please elaborate on this
for me? My data source is coming from Access in case that is a
problem.

EMC

"Graham Mayor" wrote:

I said don't used the AddressBlock! Remove the addressblock
field from the document and use instead the individual fields
that make up the address

--

Graham Mayor - Word MVP

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


emc wrote:
Graham,

I have tried it with the AddressBlock. Unfortunately I have a
number of fields and cannot match them in the Required
Information Match Fields dialagoe box resulting in a lot of my
information being omitted. I have tried matching them in the
Optional Information but this does not appear.

Unfortunately I cannot insert the fields after the
AddressBlock as these fields are required after the LastName
and before Address1.

EMC

"Graham Mayor" wrote:

For any of your question to be relevant you must be using the
AddressBlock field. Don't! Insert the individual fields as
you require them. You can then use a conditional field to
insert the FirstName field when a condition applies eg
{IF{Mergefield FirstName} "Fred" "{Mergefield FirstName}"}

--

Graham Mayor - Word MVP

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


emc wrote:
I have a mail merge with Prefix, FirstName, Surname, etc.

For various reasons when sending out mail some people should
only have their Prefix and Surname shown. I need to have
their FirstName in the merge as I use it for a large amount
of other documents otherwise I would remove it.

I have tried the "If...Then...Else" but it doesn't work and
I can't use the Skip button as this is for the entire
record. Is there another way of doing it?

Thank you.