By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,949 Members | 2,043 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,949 IT Pros & Developers. It's quick & easy.

How to control a Merge action with a word document from Access 2K?

P: n/a
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.

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.