MailMerge Problems

wavp

Registered User.
Local time
Today, 23:40
Joined
Apr 18, 2003
Messages
19
I have started having problems with MailMerge in my database - it has worked before but now I get this error:

Runtime error 5922

"Word was unable to open data source"

Here is my code:

Code:
Function MailMerge(strMMTemplate As String)
Dim objWord As Word.Application
Dim objDoc As Word.Document

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(fldMailmerge & strMMTemplate)

    'Make Word visible.
    objWord.Application.Visible = True
    'Set the mail merge data source
    objDoc.MailMerge.OpenDataSource Name:="C:\cmos\cmos.mdb", LinkToSource:=True, Connection:="TABLE tblMailMerge_Temp_Full", SQLStatement:="SELECT * FROM tblMailMerge_Temp_Full"
    'Execute the mail merge.
    objDoc.MailMerge.Execute
        objDoc.Close
        
Set objWord = Nothing
Set objDoc = Nothing
End Function

Any ideas? I am running Access 2003.

Cheers

Will
 

Users who are viewing this thread

Back
Top Bottom