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

    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 & "odis_PPS_100_CaseClosing.dot", 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:

    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, 
    Err.Description
     
    PROC2_EXIT:
    Exit Sub
     
    PROC2_ERR:
    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.

    Frank

    This post is also here: http://www.utteraccess.com/forum/Get...l#entry2209555
    Last edited by Soule; 02-13-2012 at 07:00 PM. Reason: Grammar.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    49,158
    The thread suggests slightly different approach http://www.pcreview.co.uk/forums/usi...-t3518927.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 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
    Posts
    58
    Quote Originally Posted by June7 View Post
    The thread suggests slightly different approach http://www.pcreview.co.uk/forums/usi...-t3518927.html
    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.

    Frank

  4. #4
    Soule is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Dec 2011
    Posts
    58
    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.

    Frank

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