# Word 2007 Mailmerge 'not equal' selections



## ERIM (Mar 29, 2010)

Can anyone out there help me with this one?

As membership secretary of a club, I have a series of letters relating to membership renewal invitations and an excel spreadsheet that I use as my datasource containing all the names, addresses and details of all my members.

Each of the letters are appropriate to one sub-set of my members, and worked fine when I was using Windows XP and Word 2003 with a DDE link to the spreadsheet. However, since moving to Windows 7 and Word 2007, the specific filters applied for specific letters no longer seem to work as expected, and in some cases, the mailmerge routine is adding additional filter criteria which in most cases is why I am generating letters to other membership sub-sets.

It seems that the specific problem I am experiencing is when I make use of the 'not equal to' selection in my multi-filter selection. For example, I have a column in my spreadsheet called 'Gender'. Entries in this column are either 'M' (= male), 'F' (= female), or 'N/A' (=husband and wife or advertiser or sponsor). Thus, if I want to select just the records with 'M' or 'F' in the column, the mailmerge filter reads " 'Gender' not equal to 'N/A' ". 

Typically this construction appears with two or more other filters such as 'Membership Category' = 'Non-Playing' and 'Membership Sub-Category' is not blank. However, upon completing the mailmerge I discover that Word has seemed to ignore my filter and the resulting document contains entries for non-qualifying records. Further examination of the filter reveals that Word has decided to add another filter with an 'OR' selection: " or 'Membership Sub-Category' is blank " which means that my merged document contains every record where 'Membershiop Sub-Category' is blank when I specifically want those that are not blank. 

Can anyone shed any light on why Word thinks this is appropriate behaviour, or how I can get Word to use the selection I want?
:sigh:


----------



## macropod (Apr 11, 2008)

Hi Erim,

Rather than relying on Word's record filtering, I'd suggest embedding one or more SKIPIF fields into the body of the document to exclude the records you don't want. This opens up all sorts of possibilities. For example, you could use a SKIPIF field coded along the lines of:
{SKIPIF{MERGEFIELD Last_Name}<> "{FILLIN "Output records for Last Names beginning with" \o}*"}
This will allow you to merge all records for last names beginning with 'S', for example, or beginning with 'Mc', etc. Leaving the response blank will exclude no records.

Similarly, you could use a SKIPIF field coded along the lines of:
{SKIPIF{MERGEFIELD Sex}<> "{FILLIN "Output records for (M)ales, (F)emales or (N)/A" \o \* Upper}*" \o}"}
With this coding, the user will be prompted to supply the M/F/N to indicate the records to merge. Again, leaving the response blank will exclude no records.

Another SKIPIF field you could possibly use is:
{SKIPIF{={IF{MERGEFIELD Membership_Category}= "Non-Playing" 1 0}*{IF{MERGEFIELD Membership_Sub_Category}<> "" 1 0}}= 1}

*Note:* The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message.


----------



## ERIM (Mar 29, 2010)

Hi Macropod

Many thanks for your post. I haven't come across the 'SkipIf' option before, so I'll give it a whirl to see how effective it'll be for what I want to achieve.

I already have a number of code fields embedded in my documents to use different wording depending on the recipient, so a few more curly brackets won't be a problem.

Kind regards


----------

