Problem transfering database from Access 2000 to Access 2003

L

lemur55

Hi all
I am having problems with a database which has been running for
number of years. It was set up in Access 2000 and windows 98se. I hav
now transferred the database to a new machine, running Office 2003 an
Win. XP. The Mail Merge automation now does not work and gives me
Run time error’432’ File Name or Class not found during automatio
operation. When I use the debug it points to the following line in th
code ,
Set objWord = GetObject("C:\Church Documents\") & strDocName
On further investigation objWord =0 And & strDocName= mail.doc, whic
is the name of the word document I an trying to merge the data with
The code for the mail merge automation is as follows:


Function MergeIt()

Dim objWord As Word.Document
Dim strDocName As String
Dim intResponse As Integer
Dim appWord As Word.Application
Dim objDocs As Word.Documents

Set appWord = CreateObject("Word.Application")
Set objDocs = appWord.Documents
objDocs.Add strDocName


strDocName = InputBox("Enter Name of Word Document to be merged to."
vbCrLf _
& "Note: You should write the document first and save it i
c:\church documents." _
& vbCrLf & "You can save the resulting document to any location"
_
"Mail Merge Document Title", "Mail Merge Document.doc")

Set objWord = GetObject("C:\Church Documents\") & strDocName

' Make Word visible.
objWord.Application.Visible = True

' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Church Documents\Database\Temp Data.mdb", _
LinkToSource:=True, _
Connection:="TABLE tblMailMerge", _
SQLStatement:="Select * from [tblMailMerge]"

' Execute the mail merge.
intResponse = MsgBox("Click OK to produce the document if you hav
already written it" _
& vbCrLf & _
"Otherwise click CANCEL, switch to Word and Merge the fields i
when you're ready.", _
vbOKCancel + vbExclamation, "Mail Merge")

If intResponse = vbOK Then
objWord.MailMerge.Execute
End If

End Function


Has anyone got any idea what I am missing. Please hel
 
G

Guest

Set objWord = GetObject("C:\Church Documents\") & strDocName

That's not right. It should be

Set objWord = GetObject("C:\Church Documents\" & strDocName )

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top