Hi
I have the following code to merge a query into a word document. I can only merge all the records in the query. How would I amend the code to merge only the current record displayed on the form?
Also, when it merges into word, it brings up a confirm database box with various options like MS Access Databases via DDE, OLE DB Database Files and so on. Can I remove this?
I have the following code to merge a query into a word document. I can only merge all the records in the query. How would I amend the code to merge only the current record displayed on the form?
Also, when it merges into word, it brings up a confirm database box with various options like MS Access Databases via DDE, OLE DB Database Files and so on. Can I remove this?
Code:
Dim objWord As Word.Document
Set objWord = GetObject("E:\****\Clients\pwms\Master Due Diligence Template.doc", "Word.Document")
'Make Word Visible
objWord.Application.Visible = True
'Set Merge Data Source
objWord.MailMerge.OpenDataSource Name:="E:\***\Clients\pwms\dd.mdb", LinkToSource:=True, Connection:="QUERY qryDDDocumentMerge", SQLStatement:="SELECT*FROM qryDDDDocumentMerge"
'Execute the MailMerge
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute