G
Guest
I am trying to do a mailmerge from Access and have written a post previously
about my problems, ive since partially solved those problems but have a new
related one.
I can do a mailmerge from word with no problem, associating with data from
access with no problem.
Im trying to do the same thing from a function in access but come up with a
'cannot open the datasource' problem after its opened the mailmerge document
but fails to merge it to the data from the datasource.
Debug points to the following function:
<!----
Function MergeIt()
Dim strConnection As String
Dim objWord As Word.Document
Set objWord = GetObject("\\sbserver\data\amit\Word
Documents\Agreement20051.doc", "Word.document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the forms
objWord.MailMerge.OpenDataSource Name:="\\sbserver\data\amit\Test
Database\Database1_te.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
Format:=0, _
Connection:="Query [Mergedata]", _
SQLStatement:="SELECT * FROM [Mergedata]", _
openExclusive:=False, subtype:=wdMergeSubTypeWord2000
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
--->
can anyone spot anything strange with this? why wont it open the datasource?
With much thanks
Amit
about my problems, ive since partially solved those problems but have a new
related one.
I can do a mailmerge from word with no problem, associating with data from
access with no problem.
Im trying to do the same thing from a function in access but come up with a
'cannot open the datasource' problem after its opened the mailmerge document
but fails to merge it to the data from the datasource.
Debug points to the following function:
<!----
Function MergeIt()
Dim strConnection As String
Dim objWord As Word.Document
Set objWord = GetObject("\\sbserver\data\amit\Word
Documents\Agreement20051.doc", "Word.document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the forms
objWord.MailMerge.OpenDataSource Name:="\\sbserver\data\amit\Test
Database\Database1_te.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
Format:=0, _
Connection:="Query [Mergedata]", _
SQLStatement:="SELECT * FROM [Mergedata]", _
openExclusive:=False, subtype:=wdMergeSubTypeWord2000
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
--->
can anyone spot anything strange with this? why wont it open the datasource?
With much thanks
Amit