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 MailMerge only pulls first record from SQL table when filtered

I vaguely remember a similar problem, but not the discussion or any
resolution, so can you please do the following
a. open your mail merge main document and try to apply the filter.
Then go into the Word VBA editor, issue the following commands (e.g. in
the Immediate Window, which you can display by looking in the View
menu), and post the results back he

?activedocument.mailmerge.datasource.name
?activedocument.mailmerge.datasource.connectstring
and
?activedocument.mailmerge.datasource.querystring

b. tell us the data type of the InvoiceNumber column in SQL/Access

Peter Jamieson

http://tips.pjmsn.me.uk

On 07/12/2009 05:29, James wrote:
Software versions:

Word 2007
SQL 2005
Access 2007

Issue: When I attempt to do a mailmerge from within Word when linking back
to a basic table in SQL or Access and I attempt to filter on a particular
field (ie InvoiceNumber), it will only choose the very first record of the
table if there are just 10 records or thousands in it. I've not only tried
setting the filter so that the InvoiceNumber equaled the number but I've also
tried using a compound filter where the InvoiceNumber 4 and InvoiceNumber
6 in order for it to select invoice number 5 and that didn't work either, it
would simply pull the first record, no matter what the InvoiceNumber was.

I've found scattered posts on Google about this particular issue with Word
2003 and 2007 and MailMerge but none of the solutions worked. Has anyone
else seen this before and if so, what did you do to fix it?

Thanks for your help!

James