I have an issue doing a simple mailmerge from Access; while using a query.
(either by using ODBC or ole datasource)
The code I use basically just let's word start a mailmerge document and
merge the document
I already solved one issue (Disabling SQL warning)
(http://www.support.microsoft.com/?kbid=825765) and this code runs with a
regular query.
The problem is that I want to use a query that is behind a subform and
changes the records when browsing through the records of the main form.
The code is started from that mainform and should only merge the records
that you can see on that subform.
Using the same query filtered with a field on the form; the mailmerge
document does not open not from the code, neither directly.
There must be different code available to enable to run the mailmerge from
Access in such a way that the data can be filtered according to form
fields??
If somebody has some sample code available and would send it me; that would
make me a happy programmer!
Philip
ps code, see below
'create word object and do mailmerge
If CreateWordObj() Then
With gobjWord
'.Visible = True
.Documents.Open strDocumentPath
DoEvents
With gobjWord.ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
.Execute
End With
.ActiveDocument.PrintPreview
.Visible = True
End With
End If
Doug Robbins - Word MVP - 25 Dec 2004 00:49 GMT
Check out: the one click mailmerge from Access utility on fellow MVP Albert
D Kallal's website at:
http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
You can modify it so that it interates through each of the records displayed
on your subform to print each one.

Signature
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
> I have an issue doing a simple mailmerge from Access; while using a query.
> (either by using ODBC or ole datasource)
[quoted text clipped - 36 lines]
> End With
> End If