I have several mail merge docs that I call up from Access. Access creates a new Word doc to contain the data, saves and closes that doc, then opens the mail merge doc. They have all lost their connection to the data docs. The data docs have the correct data, but the mail merge docs won’t link to them. I manually link the doc and save it, but next time the data remains unconnected. These docs have been working perfectly for years. I first noticed this a couple of months ago, but it has taken me this long to see that it happens every time. (yeah I know I’m slow).
any ideas anyone?
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Word wont save mailmerge data connection
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Word wont save mailmerge data connection
- This topic has 11 replies, 4 voices, and was last updated 16 years ago.
AuthorTopicWSPeter Kinross
AskWoody LoungerJune 21, 2009 at 6:49 pm #460667Viewing 2 reply threadsAuthorReplies-
WSHansV
AskWoody LoungerJune 22, 2009 at 12:51 am #1165743Has the path to the data source become very long? If so, this could have caused the connection string to become too long so it would be truncated when the document is saved.
BTW when performing a mail merge from Access, I never save the connection info with the mail merge document. I use Automation to open the mail merge document and use Mailmerge.OpenDataSource to specify the SQL string and to connect to the database. After performing the mail merge, I close the source document without saving it.
-
WSPeter Kinross
AskWoody LoungerJune 22, 2009 at 2:43 am #1165747The path to the Data doc is only: “C:AccessInsurancMergeDocsAppointment Letter Data.doc”, and has been operating unchanged for many years.
I don’t use ‘Mailmerge.OpenDataSource to specify the SQL string and to connect to the database’. My way is a hangover of very early versions of Access, where to use an Access object as data source, started up another instance of Access. In those days, the less apps running the better. As it always worked very smoothly, I never changed it. It does have the advantage of enabling me to open the data doc to see who was the last recipient of that letter.
-
WSHansV
AskWoody Lounger -
WSPeter Kinross
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSPeter Kinross
AskWoody LoungerJune 22, 2009 at 6:59 pm #1166016I have gone through the code and can’t see why the problem is occurring. Hopefully you will be able to pinpoint the boo boo.
Here is a stripped down version of the code.[codebox]Function PrintContactLetter(LetterF As Form)
‘Called from [Envelope Dialog] Form
Dim S As String, Tb As String, St As String, MrgDir As String
Dim ThisString As String, ThisDoc As String
Dim Lf As String
On Error GoTo Err_PrintContactLetter
MrgDir = DLookup(“[MergeDirectory]”, “Paths”)
Tb = Chr$(9): Lf = Chr$(10)
S = “FirstName” & Tb & “LastName” & Tb & “Company” & Tb & “Street” & Tb & “Suburb”
S = S & Tb & “Both” & Tb & “RepPd”
On Error Resume Next
Set appWd = GetObject(, “Word.Application”)
On Error GoTo Err_PrintContactLetter
If appWd Is Nothing Then
Set appWd = CreateObject(“Word.Application”)
End If
If appWd Is Nothing Then
MsgBox “Can’t start Word.”, vbExclamation
GoTo Exit_PrintContactLetter
End If
ThisDoc = “ClientLetter.doc”
On Error Resume Next
‘If the letter is open, we need to close it, so we can edit it’s data source doc.
Name MrgDir & ThisDoc As MrgDir & ThisDoc
If Err.Number 0 Then
On Error GoTo Err_PrintContactLetter
appWd.Documents(ThisDoc).Close SaveChanges:=wdDoNotSaveChanges
End If
On Error GoTo Err_PrintContactLetter
appWd.Application.Visible = False ‘otherwise Word becomes visible here
With appWd
On Error Resume Next
.Documents.Open MrgDir & “Appointment Letter Data.doc”
If Err.Number 0 Then
On Error GoTo Err_PrintContactLetter
MsgBox “Can’t get names etc into the required doc.” & vbCrLf & _
“You will have to close all ‘Insurance’ Word docs,” & vbCrLf & _
“and try again!”, vbCritical
GoTo Err_PrintContactLetter
End If
On Error GoTo Err_PrintContactLetter
With .Selection
.HomeKey Unit:=wdStory ‘Go to start of document
.EndKey Unit:=wdStory, Extend:=wdExtend ‘Select whole document
.Delete Unit:=wdCharacter, Count:=1 ‘Delecte the lot
.InsertAfter S + Lf ‘insert field headings
End With
End With
With LetterF
St = ![Street]
ThisString = Nz(![FirstName])
S = ThisString & IIf(ThisString “”, ” “, “”) & Tb
S = S & Nz(![LastName]) & Tb
‘function StripLineFeeds gets rid of any line feeds
‘within the fields causes Word to make a new record.
S = S & StripLineFeeds(Nz(!Company)) & Tb
S = S & StripLineFeeds(St) & Tb
S = S & StripLineFeeds(Nz(![Suburb])) & Tb
S = S & IIf(Nz(LetterF![SpouseToAddressCheckBox]), “yes”, “no”) & Tb
S = S & Nz(![ReplyPd])
End With
With appWd
.Selection.InsertAfter S
.ActiveDocument.SaveAs MrgDir & “Appointment Letter Data.doc” ‘|Save now so no
.Documents.Close wdDoNotSaveChanges ‘|dialog box on closing
.Documents.Open MrgDir & ThisDoc
.Visible = True
.ActiveDocument.PageSetup.FirstPageTray = gMPBin ‘MP Tray
.ActiveDocument.PageSetup.OtherPagesTray = wdPrinterLowerBin ‘Tray 2
”’ .WindowState = wdWindowStateMaximize ‘Taken out 17 Feb 09
.Application.Activate
End With
DoCmd.Close acForm, LetterF.Name, acSaveNo
Exit_PrintContactLetter:
On Error Resume Next
Set appWd = Nothing
Exit FunctionErr_PrintContactLetter:
MsgBox Err.Description
Resume Exit_PrintContactLetter
Resume
End Function[/codebox]
-
-
-
-
-
WSjscher2000
AskWoody LoungerJune 22, 2009 at 3:50 pm #1165948Does this problem occur only when you replace the data document? In other words, if you try the merge again without replacing the data .doc file, does Word protest that it can’t find the document? Just wondering whether there is more to keeping the same data source than merely the file path and name.
-
WSPeter Kinross
AskWoody LoungerJune 22, 2009 at 6:41 pm #1166013Hans: Other docs are doing the same.
jscher: Interesting thought. If I simply re-open the mail merge letter – the data is still attached. If I manually alter the data doc (not through Access), the mail merge doc is still attached to the data source and reflects the changes. So it looks like you have isolated Access as the cause.
Andrew: I haven’t set the docs to remove personal info.
Thanks guys, I will step through the code to see if I can find the bug. Any ideas would still very much be appreciated.
-
WSHansV
AskWoody LoungerJune 22, 2009 at 7:01 pm #1166018Do you have Access 2003 SP3? If so, you might try the two post-SP3 hotfixes released by Microsoft:
Access 2003 post-Service Pack 3 hotfix package: November 21, 2007
Access 2003 post-Service Pack 3 hotfix package: December 18, 2007
They don’t list the problem that you have, but they correct several bugs in SP3. -
WSPeter Kinross
AskWoody LoungerJune 22, 2009 at 7:32 pm #1166022Do you have Access 2003 SP3? If so, you might try the two post-SP3 hotfixes released by Microsoft:
Access 2003 post-Service Pack 3 hotfix package: November 21, 2007
Access 2003 post-Service Pack 3 hotfix package: December 18, 2007
They don’t list the problem that you have, but they correct several bugs in SP3.thanks for that Hans, but I didn’t need to. I just added the line:
appwd.ActiveDocument.MailMerge.OpenDataSource DataDoc
to the code. Works like a charm.
Thanks guys.
-
-
-
-
Andrew Lockton
AskWoody_MVPJune 22, 2009 at 6:37 pm #1166011I don’t have a solution but was wondering if the data connection is considered ‘personal information’ and might be removed when you choose to remove personal information from the document. I can’t recall whether Word 2003 even had this setting to remove personal information but Word 2007 certainly does.
Viewing 2 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
MS-DEFCON 3: Businesses must tread carefully
by
Susan Bradley
9 minutes ago -
McLaren Health Care says data breach impacts 743,000 patients
by
Nibbled To Death By Ducks
10 hours, 1 minute ago -
WhatsApp banned on House staffers’ devices
by
Alex5723
5 hours, 3 minutes ago -
Is your device eligible?
by
Susan Bradley
13 hours, 1 minute ago -
Windows 11 Insider Preview build 26200.5661 released to DEV
by
joep517
19 hours, 12 minutes ago -
Windows 11 Insider Preview build 26120.4452 (24H2) released to BETA
by
joep517
19 hours, 13 minutes ago -
Hello Windows…My Problem is Windows Hello…
by
rdleib
20 hours, 28 minutes ago -
New Canon Printer Wants Data Sent
by
Win7and10
20 hours, 46 minutes ago -
I set up passkeys for my Microsoft account
by
Lance Whitney
10 hours, 17 minutes ago -
AI is for everyone
by
Peter Deegan
20 hours, 20 minutes ago -
Terabyte update 2025
by
Will Fastie
14 hours, 22 minutes ago -
Migrating from Windows 10 to Windows 11
by
Susan Bradley
28 minutes ago -
Lost sound after the upgrade to 24H2?
by
Susan Bradley
1 day, 19 hours ago -
How to move 10GB of data in C:\ProgramData\Package Cache ?
by
Alex5723
2 minutes ago -
Plugged in 24-7
by
CWBillow
1 day, 5 hours ago -
Netflix, Apple, BofA websites hijacked with fake help-desk numbers
by
Nibbled To Death By Ducks
2 days, 8 hours ago -
Have Copilot there but not taking over the screen in Word
by
CWBillow
2 days, 5 hours ago -
Windows 11 blocks Chrome 137.0.7151.68, 137.0.7151.69
by
Alex5723
3 days, 23 hours ago -
Are Macs immune?
by
Susan Bradley
15 hours, 22 minutes ago -
HP Envy and the Function keys
by
CWBillow
3 days, 7 hours ago -
Microsoft : Removal of unwanted drivers from Windows Update
by
Alex5723
1 day ago -
MacOS 26 beta 1 dropped support for Firewire 400/800
by
Alex5723
4 days, 11 hours ago -
Unable to update to version 22h2
by
04om
1 day, 19 hours ago -
Windows 11 Insider Preview Build 26100.4482 (24H2) released to Release Preview
by
joep517
4 days, 18 hours ago -
Windows 11 Insider Preview build 27881 released to Canary
by
joep517
4 days, 18 hours ago -
Very Quarrelsome Taskbar!
by
CWBillow
4 days, 4 hours ago -
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
5 days, 7 hours ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
4 days, 20 hours ago -
Is your battery draining?
by
Susan Bradley
1 day, 2 hours ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
1 day, 20 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.