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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge from Access form to a word document

Status
Not open for further replies.

piranna

Technical User
Apr 6, 2004
4
0
0
CA
Hello,

I have a form with a combo box that allows you to select an account and a button that takes you to a form that displays the information i want to merge.
The query for the form with the information diplayed has[forms]![frmletterintro][LetterAccount] in the criteria of the account field.
I have the word document set up with the fields of that query.
when i select the query (qryletterintro) and go to Tools-Office Links-Merge it with MS Word and go through the wizard i get an error:
"The data source of the document you selected is different from the source you selected when starting the Mail Merge Wizard .Would you like to change the source?"
To which I answer Yes, only to get a Enter parameter box with [forms]![frmletterIntro].[letterAccount]

"Letteraccount" is the name of the combo box on the first form with the drop down of accounts (frmLetterIntro)
frmLetterIntro2 is the name of the form that comes up with all the information from the query.

Any Comments,suggestions or thoughts would be very helpful.

Thankyou for your time

Regards,
Anna
 
The office link looks at the data source property of the form that is active when the link is started. The specific field you had focus on, and it's value are not considered for the connection.

For your example to work qryletterintro should be the data source of the form that is active when you select the mail merge wizard.

I have worked around this issue by opening the word document with VBA code. The document is already saved with the mail merge setting, and is pointed to the desired query. The following code will launch word and open the specified document. The assumption here is that the mail-merge.doc file is in the same directory as the access db. You can specify a full path with the file name.
Code:
    Dim oApp As Object
    Set oApp = CreateObject("Word.Application")
    oApp.Visible = True
    oApp.Documents.Open ("mail-merge.doc")
Good luck,

Stephen Bohman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top