View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
James James is offline
external usenet poster
 
Posts: 113
Default MailMerge only pulls first record from SQL table when filtered

Peter,

I may be able to save you some time. I actually found a post that you had
replied to some 3 1/2 years ago in the forum entitled, "Word
2003/Access2000/SQLSVR". I read through the entire posting and am having the
identical issue with Word 2007/Access 2007/SQLSVR2005. So it appears to be
something in Microsoft's code that they never addressed--probably not enough
complaints.

While it is not the cleanest way to do it, I've simply created a query in
Access for the client to put in an invoice number which in turn creates a
single row table in SQL for them to run a non-filtered mail merge from Word.
It works and I realize there is an opportunity for an issue to arise if more
than one person tries to merge at a time but that will be a very, very rare
occassion.

Thanks again for your help!

James

"Peter Jamieson" wrote:

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

.