nathangoldhill
Registered User.
- Local time
- Today, 00:44
- Joined
- Aug 6, 2001
- Messages
- 12
I have set up an automatic mail merge to run using a parameter query. The problem is that when i do it automatically using the code below it crashes with a doctor watson. The weird thing is if i do it manually from word it works. I have also set it up using dde instead of obdc and it still also opens another instance of access.
Any ideas?
Cheers Nathan. (Code See below)
Function MergeIt3()
Dim objWord As Word.Document
Set objWord = GetObject("y:\stats database\notices.doc", "Word.document")
' Make Word Visable.
objWord.Application.Visible = True
'set the mail merge data source as statstatus#2 database
objWord.MailMerge.OpenDataSource _
Name:="y:\stats database\statstatus#2.mdb", _
LinkToSource:=True, _
Connection:="QUERY notice", _
SQLStatement:="Select * from [notice]"
' Execute the mailmerge.
objWord.MailMerge.Execute
End Function
Any ideas?
Cheers Nathan. (Code See below)
Function MergeIt3()
Dim objWord As Word.Document
Set objWord = GetObject("y:\stats database\notices.doc", "Word.document")
' Make Word Visable.
objWord.Application.Visible = True
'set the mail merge data source as statstatus#2 database
objWord.MailMerge.OpenDataSource _
Name:="y:\stats database\statstatus#2.mdb", _
LinkToSource:=True, _
Connection:="QUERY notice", _
SQLStatement:="Select * from [notice]"
' Execute the mailmerge.
objWord.MailMerge.Execute
End Function