error 462 remote server does not exist

N

Ngan Bui

I have office XP and used the code from the KB article to
sent the current Access XP record to Word using
Automation: http://support.microsoft.com/default.aspx?
scid=KB;EN-US;q210271&

Once in awhile, one user gets the error 462 remote server
does not exist or is unavailable. In my code, I do not
quit Word because the user needs to preview and print the
doc. She then closes the Word and not save the file. At
this point is when the error happens. This problem is not
happening on any other computer.

I've done a search thru google about this error and read
about issues one may run into using early binding and
about Automation Error Calling Unqualified Method or
Property (http://support.microsoft.com/default.aspx?
scid=kb;EN-US;189618).

I'm not quite sure where to fix the problem in my code,
and why only one user is having this problem. Please
help! Below is a snippet of the code:

Private Sub prevletter_Click()
On Error GoTo err_prevletter
Dim filepath, strDocName As String

Dim objWord As Word.Application
Dim wdDoc As Word.Document
filepath = "O:\Databases\Documents\Complaints\"
strDocName = "CompResponse" & F!LetterVersion & ".dot"

' Start Microsoft Word.
Set objWord = CreateObject("Word.Application")
Set wdDoc = objWord.Documents.Add(filepath & strDocName)
With objWord
' Make the application visible.
.Visible = True
' Move to each bookmark and insert text from the
form.
.ActiveDocument.Bookmarks("SentDate").Select
.Selection.Text = (Format(F!SentDate, "mmmm d,
yyyy"))
.ActiveDocument.Bookmarks("FirstName").Select
.Selection.Text = (CStr(F2!FirstName))
.ActiveDocument.Bookmarks("LastName").Select
.Selection.Text = (CStr(F2!LastName))
....
End With
Set wdDoc = Nothing
Set objWord = Nothing
Exit Sub

exit_prevLetter:
objWord.Quit
Set wdDoc = Nothing
Set objWord = Nothing
Exit Sub

err_prevletter:
' If a field on the form is empty
' remove the bookmark text and continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
Else
MsgBox Err.Number & vbCr & Err.Description
End If
Resume exit_prevLetter

End Sub
 
C

Cindy Meister -WordMVP-

Hi Ngan,
I did set the Word app object to nothing. I set both the
Word.Application and Word.Document to nothing at the end
of the function:
Thanks for the more complete code snippet :)

I do note one thing you want to change in your code, and
this might help with the problem (although it might not):
' Move to each bookmark and insert text from the
form.
.ActiveDocument.Bookmarks("SentDate").Select
.Selection.Text = (Format(F!SentDate, "mmmm d,
yyyy"))
It's more efficient to simply put the data directly into the
bookmarks, rather than jumping all around the document,
selecting them. Also, you've created a document object - you
should USE it, rather than "ActiveDocument"

objWord.Activate
objWord.Visible = True

With wdDoc
.Bookmarks("SentDate").Range.Text _
= (Format(F!SentDate, "mmmm d, yyyy"))
'etc.
End With

<<Once in awhile, one user gets the error 462 remote server
does not exist or is unavailable. In my code, I do not
quit Word because the user needs to preview and print the
doc. She then closes the Word and not save the file. At
this point is when the error happens. This problem is not
happening on any other computer.>>

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
N

Ngan Bui

Thanks for the suggestion. I'll have to wait and see if
the error comes up again after the changes. It could be a
day or a few days.

It's strange, I have this code on many other forms in
other dbs...no problems from them yet. Not sure why this
code in this one form for this one user is causing so much
trouble. (btw it's not the computer, cuz we did switch
out comps).

I'll post back a new msg if I get any more trouble!

Thanks again.

btw, that code came straight from MS KB...you think it
would be stable.

Ngan
 

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