Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    2

    Unhappy Unanswered: Document Merge - Access 2003 to Word 2010

    Hi All,

    I was looking for some help if possible. I have a database which we use to fill in a word based document.
    My company is looking to upgrade MS Office to the 2010 version (this has already been done on my PC) and I have now discovered that the code that I previously used for mail merge no longer works with Word 2010.

    Does anyone know what needs to be changed in order to make this code work with 2010?
    Is there code that will work with both versions, no matter which Word is installed on the machine, or will it be best to distribute 2 versions of the "front end"?
    The code that I am currently using is:

    Private Sub Form_Open(Cancel As Integer)

    Dim appWord As Word.Application
    Dim doc As Word.Document
    'Avoid error 429, when Word isn’t open.
    On Error Resume Next
    Err.Clear
    'Set appWord object variable to running instance of Word.
    Set appWord = GetObject(, "Word.Application")
    If Err.Number <> 0 Then
    'If Word isn’t open, create a new instance of Word.
    Set appWord = New Word.Application
    End If
    Set doc = appWord.Documents.Open("T:\path\form2.doc", , True)
    With doc
    .FormFields("sender").Result = Me!PSCC_Op_Name
    .FormFields("DateTime").Result = Me!Date_Raised
    .FormFields("cwsite").Result = Me!CW_Site_Code
    .FormFields("sitename").Result = Me!Site_Name
    .FormFields("remedy").Result = Me!Fault_Number
    .FormFields("Action").Result = Me!CCNumber
    .FormFields("mitiesite").Result = Me!Mitie_Site_Code
    .FormFields("authdm").Result = Me!Auth_DM_Name
    .FormFields("group4").Result = Me!G4_Site_Code
    .FormFields("Address").Result = Me!Address
    .FormFields("postcode").Result = Me!Post_Code
    .FormFields("details").Result = Me!Request_Description
    .FormFields("Type").Result = Me!Fault_Type
    .FormFields("Priority").Result = Me!Priority
    .FormFields("controlroomto").Result = Me!Dist_List

    .Visible = True
    .Activate
    End With
    Set doc = Nothing
    Set appWord = Nothing
    Exit Sub
    End Sub


    Any help you could provide would be much appreciated

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Quote Originally Posted by dpeacock View Post
    ... I have now discovered that the code that I previously used for mail merge no longer works with Word 2010.
    "no longer works" is quite vague. What happens? What error message (if any) do you receive?
    Have a nice day!

  3. #3
    Join Date
    May 2012
    Posts
    2
    No error message. It opens tries to install something on first use, and then doesnt open microsoft word, and doesnt fill a form in at all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •