View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Filtering from Access Database

There are definitely problems with Word's filtering for some types of data
source. After you have entered your filter (and sort) criteria, Word
converts the criteria into an SQL statement that it uses to get the filtered
data from the data source. Unfortunately,
a. sometimes the filter criteria are wrongly replicated
b. sometimes Word generates SQL that the data source does not understand.

It may be that changing the connection method to DDE (check Word
Tools|Options|General|Confirm conversions at open, reconnect to the data
source, and choose DDE when offered) is enough to fix this. If not, I do not
think there is anything you can do about this without "programming" in
either Access or Word.

If you are doing these merges yourself and know how to use SQL and Word VBA,
the simplest approach is probably to create a small VBA module that calls
OpenDataSource with all the right details including a valid SQL statement
(or sets ActiveDocument.MailMerge.DataSource.QueryString), then modify the
SQL and run the module before each merge. otherwise, you might be able to
moduify the query in Access each time.You might also be able to create a
parameter query in Access and use that. However, if you do, you need to
connect using DDE as described above. Also, the dialog boxes that prompt for
the parameters sometimes appear behind the Word window, which sometimes
makes it look as if Word has hung, when what you actually need to do is
Alt-tab to the dialog box.

Peter Jamieson


"novice" wrote in message
...
I am trying to merge some addresses from Access Database. I am trying to
filter the addresses during merge using the arrow next to Zip column.
However, it keeps on merging all the data in the file irrespective of the
filter condition. When I go back to the query I had build using the
'advanced' filter I find it has added a number of query clauses by itself.
How do I make it work.

The access database is sorted by Zip.