Problems transferring a database from acsess2000 to access2003

tiger1955

New member
Local time
Today, 17:39
Joined
Sep 24, 2005
Messages
2
Problems transferring a database from access2000 to access2003

Hi

I have a database that was set up using Office 2000 and running
on windows 98SE. I have now upgraded the machine and now running Windows XP and Office 2003.
I have transferred the database to the new machine and all works fine until I try and do a mailmerge using the following code.

Code:
Function MergeIt()

Dim objWord As Word.Document
Dim strDocName As String
Dim intResponse As Integer

strDocName = InputBox("Enter Name of Word Document to be merged to." & vbCrLf _
    & "Note: You should write the document first and save it in 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 have already written it" _
'    & vbCrLf & _
'    "Otherwise click CANCEL, switch to Word and Merge the fields in when you're ready.", _
'    vbOKCancel + vbExclamation, "Mail Merge")
'
'If intResponse = vbOK Then
'    objWord.MailMerge.Execute
'End If

End Function

The error I get back is Error”432” and running the debug points to the code Set objWord = GetObject("C:\Church Documents\" & strDocName)

Anybody with suggestions
 
Last edited by a moderator:
Hi,
have you checked all your references (vba editor--tools--references)?
Are any marked missing? Did you check the DAO object library and the word object library?
HTH
Good luck
 
For those curious a 432 error is "File name or class name not found during Automation operation"

The references seems to be the logical approach. An easier way to check your references is to go to your Dim statement and retype the "Word.Document" --- when you get to "Word." the popup menu should come up with your options.

However I'm not sure you're defining all your needed variables. Try adding the below:

Code:
Dim appWord As Word.Application
Dim objDocs As Word.Documents

Set appWord = CreateObject("Word.Application")
Set objDocs = appWord.Documents
objDocs.Add strDocName
 
Thank you both for your replies.
I firstly cheched the reference library and found the following references:
VB for Applications
MS Access 11.0 oject library
OLE Automations
MS DAO 3.6 object library
MS VB for applications extensiblity 5.3
MS Word 11.0 Object Library
MS Outlook 11.0
MS Forms 2.0 Object Library
MS Office Object Library
MS ActiveX Data Object 2.8 Library
As I an a newby to VB and Access I am not sure if I am missing any referances.

I have also tried inserting the code suggested by Modest, but still no joy.

Any more suggestions Please
Many Thanks for your support
 

Users who are viewing this thread

Back
Top Bottom