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:
I have searched high an low through the forum and web - but no luck.
Any ideas? I am running Access 2003.
Cheers
Will
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
I have searched high an low through the forum and web - but no luck.
Any ideas? I am running Access 2003.
Cheers
Will