C
Connie
Hi All:
I have a database that is sending data to Word for a mailmerge. It is a
dynaset and opens the correct letter (case statement) then merges data into a
new document. It works great in Access Word 97 and Access Word 2000, but
2002, No, and 2003 NO!
Here is my code and if someone could just help me with this, or show me the
error of my ways, I would so very, very thankful! I have been working on this
for three years, off and on to try to make this work, please help, I have no
more ideas.....Regards, Connie
Dim objwordapp As Word.Document
Dim objWord As String
Dim tblName As String
'Set objwordapp = CreateObject("word.application")
'Set objword = objwordapp.Documents.Open(fname)
objWord = fName
Set objwordapp = GetObject(objWord, "Word.Document")
tblName = "tblqry" & Left(savedName, 8)
objwordapp.Application.Visible = True
'Execute the mail merge.
objwordapp.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE " & tblName, _
SQLStatement:="Select " & tblName & ".* from " & tblName
objwordapp.MailMerge.Execute
objwordapp.Close
objwordapp.ActiveDocument.SaveAs (mypath & "\" & savedName)
objwordapp.Quit
'Dim objWord As Word.Document
'Dim stMergeDoc As String
'If fSetAccessCaption Then
'On Error Resume Next
'stMergeDoc = "J:\install\Access mdbs\mailmerge.doc"
'Set objWord = GetObject(stMergeDoc, "Word.Document")
'objWord.Application.Visible = True
'objWord.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE Customers", _
SQLStatement:="Select * from [Customers]"
'objWord.MailMerge.Execute
rs.AddNew
rs!GameNames = GameName
rs!Merged = True
rs.Update
I have a database that is sending data to Word for a mailmerge. It is a
dynaset and opens the correct letter (case statement) then merges data into a
new document. It works great in Access Word 97 and Access Word 2000, but
2002, No, and 2003 NO!
Here is my code and if someone could just help me with this, or show me the
error of my ways, I would so very, very thankful! I have been working on this
for three years, off and on to try to make this work, please help, I have no
more ideas.....Regards, Connie
Dim objwordapp As Word.Document
Dim objWord As String
Dim tblName As String
'Set objwordapp = CreateObject("word.application")
'Set objword = objwordapp.Documents.Open(fname)
objWord = fName
Set objwordapp = GetObject(objWord, "Word.Document")
tblName = "tblqry" & Left(savedName, 8)
objwordapp.Application.Visible = True
'Execute the mail merge.
objwordapp.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE " & tblName, _
SQLStatement:="Select " & tblName & ".* from " & tblName
objwordapp.MailMerge.Execute
objwordapp.Close
objwordapp.ActiveDocument.SaveAs (mypath & "\" & savedName)
objwordapp.Quit
'Dim objWord As Word.Document
'Dim stMergeDoc As String
'If fSetAccessCaption Then
'On Error Resume Next
'stMergeDoc = "J:\install\Access mdbs\mailmerge.doc"
'Set objWord = GetObject(stMergeDoc, "Word.Document")
'objWord.Application.Visible = True
'objWord.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE Customers", _
SQLStatement:="Select * from [Customers]"
'objWord.MailMerge.Execute
rs.AddNew
rs!GameNames = GameName
rs!Merged = True
rs.Update