473,503 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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

Nov 13 '05 #1
0 1504

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
12483
by: Steve M | last post by:
I'm trying to do invoke the mail merge functionality of MS Word from a Python script. The situation is that I have a template Word document, and a record that I've generated in Python, and I want...
2
5124
by: Lee | last post by:
I have a Word template that is set to merge with our client database. After I run the merge, I merge to a new document, and then save the new document. When I reopen this saved document, it prompts...
8
9493
by: Squirrel | last post by:
Hi everyone, I've created a mail merge Word doc. (using Office XP) , the data source is an Access query. Functionality I'm attempting to set up is: User sets a boolean field to true for...
9
4310
by: Neil Ginsberg | last post by:
I have a strange situation using Access to automate a Word mail merge. Using Access 2000 and Word 2000, the code opens Word, opens the document in Word, sets a table in the calling Access...
4
6259
by: Dadio | last post by:
Hello On my Access database form I have a command button which opens a Word mail merge document in which I have created a number of fields (Title, FirstName, LastName, Address1 etc.) I would...
3
5566
by: Andy Davis | last post by:
I have set up a mail merge document in Word 2003 which gets its data from my Access 2000 database. I want to set up a button on a form that: 1. runs the query to provide the dat for the merge...
0
2163
by: Linda Cacina | last post by:
Hello all you fine folks, Here is some code I am using to merge data from a single record Access 2K3 table into a NEW word document based on a pre-defined Word merge template doc. All I want to...
8
13322
by: Ron B | last post by:
Help!!! What am I doing wrong? I am working with Office 2003 and am trying to create a command button on an Access form that will create a mail merge in Word from an Access table. I want to...
1
6527
by: Esther Lane | last post by:
Hello! First off, many many thanks to Albert who wrote the Mail Merge code for MS Access I am using. It has been working beautifully for a few years. However, my client just (without notice!)...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.