Hi folks,
I am using the following code to merge data from an Access table to a
pre-defined Word 2000 merge document. It al works fine except for ONE
problem -- after the merged document displays and the user saves it or
whatever, then closes it, the actual merge template is displayed in
the background and asks if the user wants to save the updated merge
document. I do not want the user to even be aware of the merge
template at all. I even set the merge document to read only and it
STILL does this. Anyone know what I'm overlooking?
Dim fID As Long
Dim strSQL As String
Dim objWord As Word.Document
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
fID = Me.txtFaxID
strSQL = "SELECT tblSavedFaxes.FaxID, tblSavedFaxes.From,
tblSavedFaxes.FullName, " & _
"tblSavedFaxes.Facsimile, tblSavedFaxes.Telephone, " & _
"tblSavedFaxes.CID, tblSavedFaxes.[DACSFileNum],
tblSavedFaxes.Importance, " & _
"tblSavedFaxes.RE, tblSavedFaxes.MsgBody INTO
TEMP_FaxPrint " & _
"FROM tblSavedFaxes WHERE (((tblSavedFaxes.FaxID)=" & fID
& "));"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Set objWord = GetObject("C:\DACS\FaxMerge.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the DACS Database.
objWord.MailMerge.OpenDataSource Name:="C:\DACS\DACS.mdb",
LinkToSource:=True, Connection:="TABLE TEMP_FaxPrint",
SQLStatement:="SELECT * FROM [TEMP_FaxPrint]"
objWord.MailMerge.Destination = wdSendToNewDocument
' Execute the mail merge.
objWord.MailMerge.Execute