Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2001
    Location
    WV, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mail Merge From Access (Access 2000)

    I'm trying to execute a mail merge from the results of an access query. I've tried some of the code examples from Microsoft's Support pages with no luck. Anyone with some quick and dirty code examples willing to share???

  2. #2
    2 Star Lounger bobdog's Avatar
    Join Date
    Jan 2001
    Posts
    108
    Thanks
    3
    Thanked 5 Times in 4 Posts

    Re: Mail Merge From Access (Access 2000)

    I've seen a number of solutions to this, but the one I settled on for my most recent app is the best: no code, no library references, no finesse, no concern about how many copies of Word are currently open, no MS bugs. Just brute force.

    Send your query to a table (say, WordWork) and close Access. Do the mail merging in Word where you have all the editing tools you need and simply use WordWork as your data source. As soon as you connect up, the fields in the WordWork table are available for use.

    It's not an intuitive choice for a coder, but why do you have to push data at a monster? In my case, I had uniform data to work with (I just output fields that are relevant for a mailmerge like name and address stuff), so it works fine.

    One nice side-effect is that the list is reusable-print your letter, and then reuse it for envelopes or labels.

    Sometimes lo-tek works.

    If ya gotta, and you've got FMS Code Library, it's got a class you can use that has a fair amount of functionality, but you can't do everything. If you use Word directly, you can. I decided it wasn't worth the trouble, and I'm glad I did.

  3. #3
    New Lounger
    Join Date
    May 2001
    Location
    WV, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mail Merge From Access (Access 2000)

    Thanks for your suggestion. I finally got it working with the following code:
    Public Function MergeIt()

    Dim objWord As Word.Document
    Set objWord = GetObject("Cocuments and SettingsmamosMy DocumentsPhillipFinal ProjectAcceptLetter.doc", _
    "Word.Document")
    ' Make Word visible.
    objWord.Application.Visible = True
    objWord.MailMerge.Destination = wdSendToNewDocument
    objWord.MailMerge.Execute
    objWord.Application.Options.PrintBackground = False
    objWord.Application.WindowState = wdWindowStateNormal
    objWord.Application.ActiveDocument.PrintOut
    objWord.Application.ActiveDocument.Close

    End Function

    Works OK after tweeking

Posting Permissions

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