Results 1 to 4 of 4
  1. #1
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011

    GetObject Statement Causes Error 462 - Remote Server Does Not Exist...

    Hi, All,

    I'm getting an Error 462 "the remote server machine does not exist or is unavailable" with this GetObject statement. I'm trying to open an Outlook .oft template through a form command button with code in standard module (which I'll later move to class code-behind-form).
    My environment is:
    - an .accdb Db
    - Access 2007 on Windows XP on company network
    - I have Outlook open.
    - I'm in datasheet view on my form.
    - I have sufficient DAO and ActiveX library references checked.

    The GetObject line is where it's hanging up. It causes my msgbox to fire with the 462 error. I understand the fix of adding your dimensioned variable name to the beginning of a CreateObject statement, such as "Dim mWord As Object...Set mWord = CreateObject ("Word.Application")...mWord.Documents.Add oDocs & "", but I don't see a related fix for GetObject statements.

    I can't find a solution online anywhere. I think most people are using UNC pathnames with GetObject statements, and I'm in a networked environment where I can't (a UNC pathname because the class "Outlook.Application" causes a 432 error and I can't configure my registry on my work server).

    Here is the GetObject part of my code:

    Option Explicit
    Option Compare Database
    ' Note: Prior to this automation code, a "Lostfocus event procedure" code will run
    ' (populating the form's "Movie Code" control) when the user tabs through it.
    ' This first code procedure simply defines the error handling type in the event of.
    Public Sub SafeStart()
    Application.SetOption "Error Trapping", 1
    End Sub
    Public Sub A1_Form_Re_send_Welcome_E_Mail_Only_Button_Click()
    ' Re-send only employee Outlook e-mail populated with Access data using Outlook .oft template by clicking button.
    ' For code leaness, automation will draw on data in controls of record showing, not underlying table.
    ' To facilitate this, first procedure is a save record.
    ' Used GetObject method rather than CreateItemFromTemplate method for simplicity.
    ' Namespace/MAPI commands not used as some employees are on mail client other than Outlook.
    ' Automation code begins here:
    ' On button click but before e-mail procedures begin, record will be saved to table but REMAIN ONSCREEN (not go to new,
    ' blank record), code can draw data from the data-entry form.
    ' This first line of code saves record.
    DoCmd.RunCommand acCmdSaveRecord
    ' This next procedure opens Outlook by retrieving employee welcome e-mail template...
    ' Could not use more stable UNC path to file because of network registry issues affecting class portion of pathname.
    ' The error lines in this & each forthcoming procedure block simply tell the code where to go in event of error.
    On Error GoTo PROC2_ERR
    Dim objOutlookMsg As Object
    Set objOutlookMsg = GetObject("J:\Special Projects\Database Work\A1 Tracking DB & Related\A1 Form Button Automation Email Templates\Employee A1 Welcome Outlook Template.oft")  <-------- the statement doesn't wrap in my actual code.
    Debug.Print "Open Outlook by getting template object", Err.Number, 
    Exit Sub
    MsgBox "Error opening Outlook by getting template object." & vbCrLf & Err.Number & Err.Description, vbExclamation + vbOKOnly, "Open Outlook Through Template"
    Resume PROC2_EXIT...
    ...goes to End Sub, etc.. after this.

    This code compiles okay, but returns a 432 error on that line in run-time. Thank you so much ahead of time for your thoughts on this problem.


    This post is also here:
    Last edited by Soule; 02-13-2012 at 07:00 PM. Reason: Grammar.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    The thread suggests slightly different approach
    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Quote Originally Posted by June7 View Post
    The thread suggests slightly different approach
    Thank you for the link, June. I have templates with graphics and full HTML text and such that I have to use. I wish I could just use the mail format of the Outlook template or that Access sends! Many of my problems would be over.


  4. #4
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    I went with a CreateItemFromTemplate method and that worked without error.

    I also realized I was being TOO conservative with my error handling, and decided to go with one direction label at the beginning of my Sub and the error handler at the end of it...necessitating only one Exit Sub statement before the handler and End Sub statement. It was overly complicated before.


Please reply to this thread with any new information or opinions.

Similar Threads

  1. Table fetching remote server
    By Manotosh in forum Access
    Replies: 2
    Last Post: 10-26-2011, 09:38 AM
  2. VBA - Using GetObject function - get error.
    By jsbotts in forum Programming
    Replies: 7
    Last Post: 10-10-2011, 07:51 AM
  3. Replies: 3
    Last Post: 08-31-2011, 09:37 AM
  4. Replies: 3
    Last Post: 11-22-2009, 07:46 AM
  5. Getting date/time from remote server
    By mxfrail in forum Programming
    Replies: 4
    Last Post: 09-21-2009, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Other Forums: Microsoft Office Forums - Senior Forums