Results 1 to 4 of 4
  1. #1
    doru
    Guest

    merging from access to word

    I run a query in Access97, and I want the results to be merged in a Word document (name, address, city etc). I've set it up using Word's Documentproperties feature. The problem is that if one of the fields is empty, the merge places a blank line (ie: if address is missing, there's a blank line between the name and the city).
    Any elegant ways to accomplish this?
    thanks

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: merging from access to word

    If you set up the Mail Merge from within Word rather than Access (you can still use any object in an Access Database as your data source), you can opt not to pring blank lines when a field is empty. This is in the third step of the Merge Helper ("Merge...").[img]/w3timages/icons/thinks.gif[/img]

    -MarkJ-

  3. #3
    doru
    Guest

    Re: merging from access to word

    I had a hard time telling MS Access to take the query results, open Word and the mailmerge document, then merge (all of this using one click).
    Instead I used Word's Custom Document properties.
    I'm not biased against any method. If you can suggest a way to accomplish the former, I'd do it.
    thanks

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: merging from access to word

    Try this:
    This assumes you have your merge document set up in Word with the data source (desired query in the current database)and fields prepared on the document.

    Dim WordApp As New Word.Application
    Dim doc As Word.Document
    WordApp.Documents.Open "<path and filename of merge document>"
    Set doc = WordApp.ActiveDocument
    doc.MailMerge.Execute
    doc.Close SaveChanges:=wdDoNotSaveChanges
    WordApp.Visible = True

    This will leave the user in the newly created merged Word Document. They will have the responsibility to save the new document (unless you tell Word to save the document...).

    Enjoy![img]/w3timages/icons/thinks.gif[/img]
    -MarkJ-

Posting Permissions

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