Hi All,
When I perform a mail merge to my template word document, it works ok 1st time round, then fails 2nd time round.
Word seems to lose its connection with my database after the following code is run;
Has anyone come across this problem before, or any ideas what might be wrong? Any help would really be appreciated.
Many thanks in advance
Dave
When I perform a mail merge to my template word document, it works ok 1st time round, then fails 2nd time round.
Word seems to lose its connection with my database after the following code is run;
Code:
Me.VersionTextBox.SetFocus
strVersion = Me.VersionTextBox.Text
Dim objWord As Word.Document
Set objWord = GetObject("c:\Template.doc", "Word.document")
objWord.MailMerge.OpenDataSource _
Name:="C:\ReleaseDetailsRef.mdb", _
LinkToSource:=True, _
Connection:="TABLE DiskReleaseTable", _
SQLStatement:="SELECT * FROM [DiskReleaseTable] Where Version = '" & strVersion & "'"
objWord.MailMerge.Execute
objWord.Application.Visible = True
objWord.Close
Has anyone come across this problem before, or any ideas what might be wrong? Any help would really be appreciated.
Many thanks in advance
Dave