Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Word from Access

Status
Not open for further replies.

48Highlander

Technical User
Feb 8, 2004
119
CA
I am trying to execute a mail merge from access using a very complex query which is based on two previous queries. When I execute this mail merge manually from Word, I have to get access to this query via DDE as detailed in the following MS KB article:


When the following code executes, I get a message that Word cannot find the query. Note that the document I reference already has a link to the query via DDE.

Code:
Public Function MergeIt()

    Dim odoc As Word.Document
    Dim objWord As Object
    Dim DataSource, Connection, CurrentPath As String
        
    CurrentPath = CurrPath

    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    
    Set odoc = objWord.Documents.Add(CurrentPath & "\" _   Me.cboLetterSelect.Column(3))
    
    odoc.MailMerge.OpenDataSource Me.cboLetterSelect.Column(4)
    odoc.MailMerge.Execute
    'odoc.PrintOut

End Function

Has anyone got any ideas how I can get this to work? I am not familiar with connection methods such as OBDC but if that is what I have to learn, so be it.

Bill J
 
You might like to look at:
'Native' mailmerge reports - as painless as possible
faq181-5088
by PSeale

It is a different way of going about a mailmerge that may suit.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top