Automation Error - The server threw an exception (1 Viewer)

lmr

New member
Local time
Today, 04:30
Joined
Nov 16, 2009
Messages
2
Hi all,

A client of mine asked me to update an MS Access file.

The file is in Access 2000 format, they use Access 2002, but I used Access 2003 to perform the required modifications.

After I finished my work (everything works fine in my workstation) I tried to run in the client workstation. Everything does its job except one small part that was one of the few things that I didn't change. The ideia of that part is to generate a Word mailmerge operation and one of the steps is to use MS Word to open a txt file and save it as a doc. The code (that rests intact) is the following:

DoCmd.TransferText acExportMerge, , qry, fileName & ".txt"
On Error Resume Next
Kill fileName & ".doc"
On Error GoTo Err_ExportaDoc

' wd is declared as a Word.Application object and doc is declared as a Word.Document object
Set doc = wd.Documents.Open(fileName & ".txt", False, , , , , , , , wdOpenFormatText)
doc.SaveAs fich & ".doc", wdFormatDocument
doc.Close


The error occurs when the code hits "Open" and the error message is:

Automation Error - The server threw an exception

When I run this code using the old version it works fine, if I run it on my workstation (Access 2003 and Win XP Home edition) it is also OK, but if I run it on client's workstation (Access 2002, Win XP Professional) it throws me that error.

I runed it several times in debug mode and the wd object is always well created and it is the same object as used in the old version (that works fine). Besides that I cheked VBA references and all are exactly the same as the file version that works. I think that this should be a configuration problem but I still can not find it...

Can anyone help me on that? I spent almost one week searching for the solution and I'm still lost...

Thanks in advance.
 

HiTechCoach

Well-known member
Local time
Yesterday, 22:30
Joined
Mar 6, 2006
Messages
4,357
On the machine with an issue, what version of Word is installed?

My guess is that you are using earliy binding. Th9is means that you will have to open the database and update the Word reference to the correct version.

NOTE: Access will automatically upgrade the reference form Word 2000 to Word 2003 when you open the data with Access 2003 when Word 2003 is installed. Access will NOT down grade the refencer from 2003 to 2000 or 2002 after you have opened the file with Access 2003/Word 2003.

To get around this issue, I use late binding. This way Access will use whatever verso0n of Word is currently installed.
 

lmr

New member
Local time
Today, 04:30
Joined
Nov 16, 2009
Messages
2
Hi,

Thank you very much for your reply.

I'm relatively new to this MS Access "world", so I'm not sure if I got the message:
Your saying that I should not declare the explicit type of variables? For example replace:

Dim wd As Word.Application
Dim doc As Word.Document

by

Dim wd
Dim doc

I'm I right?

Thanks in advance.
 

Users who are viewing this thread

Top Bottom