Re: mail merge selection criteria

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi Barry,

OK, let me be sure I understand you correctly. You're in the "Filter and Sort"
dialog box (where there are multiple lines) and you set

pletter | equal to | y
and
email | is blank |

Word then adds an additional line:

or
email | is blank

FWIW, when I test this (different field names, but same type of criteria) I see
the same with Word 2003 (IE6). What's more, it happens again and again each time
I display the dialog box. So I'm guessing this may be some other update than
IE...

If I use macro code, things appear to work correctly, although the "Filter and
Sort" doesn't show the filter I've set. For example:

Sub SetMergeFilter()
Dim SQl As String
Dim TableName As String
Dim Crit1 As String, Crit2 As String

TableName = "[Office Address List]"
Crit1 = "[First Name] = 'Cindy'"
Crit2 = "[Last Name] IS NULL"
SQl = "SELECT * FROM " & TableName & " WHERE " & Crit1 & " AND " & Crit2
ActiveDocument.MailMerge.DataSource.QueryString = SQl
End Sub

You'd basically only need to substitute the information for TableName, Crit1 and
Crit2. You could even build a form to enter this. But if you can find a
combination in "Filter and Sort" that works reliably, you may prefer that...

Among the fields are two that I am sorting on. One is "pletter" and the
other "email". Out of a list of around 500 entries I am selecting people who
have asked for a periodic letter and who do not have email (I use a group
mailing in Outlook for those on email). So the select criteria is "pletter
equal to y" and "email is blank".

Whichever way round I set that it puts adds "or email is blank". If the
"and pletter is equal to y" then follows it is OK. If I select in the other
order the "or email is blank" then selects all the entries where that
criteria is matched, and this includes many more than I want.

I did find that "contains y" provided a better control.

I am rather busy now so I will have to run some tests tomorrow and vary the
criteria to see what happens. However, the automatic additional "or email is
blank" should not happen.

My upgrade was IE7 and it messed up at least two other applications so I
uninstalled it and am back to IE6 with those programmes now working. I am
unable to be sure that the upgrade to IE7 was the cause; I had not noticed it
before.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

.



Relevant Pages

  • Re: vba sort a query
    ... that i have on a 'filter' button so when I click the filter the ... comboboxes but sort by what is selected in the sortby combobox. ... the choices in the sortby combobox are Branch, vendor, item and year ... Dim strdoc As String ...
    (microsoft.public.access.formscoding)
  • Re: Is there a way to open a report in preview or report mode and have it be invisible?
    ... first sort is always enabled, the second sort only becomes enabled if ... Build a SQL string that can accomodate your recordsource, filter, ... Dim varCategory As Variant ...
    (comp.databases.ms-access)
  • "data type mismatch" trying to execute dialogue form
    ... I have a report with a form that I am trying to use to filter and then to ... then sort the report up to three levels. ... Dim strSection As String ...
    (microsoft.public.access.reports)
  • newline separated grep output
    ... I'm trying to filter a string so that I can sort it. ... that these strings appear after each other and I can't use cut/sort ...
    (comp.unix.shell)
  • Re: Filtering records on a form using multiple combo boxes
    ... So, then, you will need to build the Where string from that information, ... these 3 combo boxes have command buttons to activate the filtering ... filter the field in the record list box.. ... For the Agent Combo Box, ...
    (microsoft.public.access.forms)