P
Philip Leduc
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
(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