View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Macro language for filter

If you define a filter in the MailMerge Recipients dialog or its "advanced"
facility, Word actually "translates" your filter specifications into an SQL
SELECT statement. Precisely how it does it depends on which dialect of SQL
it thinks it needs to use. But toset up the filter in code,
a. find out the SQL that WOrd is using (e.g. look at the value of
ActiveDocument.MailMerge.DataSource.QueryString)
b. either set ActiveDocument.MailMerge.DataSource.QueryString to have the
value you need or
c. set the valuein a cal to OpenDataSource (you may have to do it this way
if you cannot use approach (b).

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Ricki Miles" wrote in message
...
I am creating a Word XP macro to create an automated mail merge. I need
the merge to happen only for reocords with an exact match to a certain
field (example DEPT = 3). After I record the macro choosing to filter on
the field during the merge, the language in the macro does not mention the
nature of the match. What is the proper macro language to make this
happen?

TIA,

Ricki