Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Location
    Durham, North Carolina, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mail Merge from Access (Access 2000/Word 2002)

    I am trying to mail merge from within Access 2000 to Word 2002. Below is the code that works when merging from Access 2000 to Word 2000. I have read that Word 2002 does not operate the same as Word 2000 for mail merge, but I have not been able to find out how to correct the code. Any suggestions would be appreciated.

    Steve

    Private Sub cmdPrintLetters_Click()


    'display letters
    MsgBox "Place Stationary in Printer and Press 'OK'", , "Print 'Thank You' Letters"

    Dim objWord As Word.Document
    Set objWord = GetObject("C:temp1strfname.doc", "Word.Document")
    ' Make Word visible.
    objWord.Application.Visible = True
    ' Set the mail merge data source as the Northwind database.
    objWord.MailMerge.OpenDataSource _
    name:="C:dataaccess_databaseskehillahmainkehillah7-16-03b.mdb", _
    LinkToSource:=True, _
    Connection:="TABLE tbltempTKY", _
    SQLStatement:="SELECT * FROM tbltempTKY"

    ' Execute the mail merge.
    objWord.MailMerge.Execute
    cmdPrintMailingLabels.Enabled = True
    cmdPrintMailingLabels.SetFocus
    cmdPrintLetters.Enabled = False
    End Sub

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Mail Merge from Access (Access 2000/Word 2002)

    You either need to set the merge method to DDE, or you need to eliminate the SQL Statement clause and just use the table - it is the same thing in your case. You might find our tutorial on mail merge Automation of interest - there are links to a number of MSKB articles as well.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Mail Merge from Access (Access 2000/Word 2002)

    Wendell already provided a useful link. To make mail merge behave as in Word 2000, add

    , SubType:=wdMergeSubTypeWord2000

    to the OpenDataSource instruction. See WD2002: Undocumented OpenDataSource Method Expression [SubType].

Posting Permissions

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