Mail Merge in Word

N

Newbie

Hi,

Access 2002

I have a letter in Word that I want to print from Access based on a query
for the recipients but I get the following error:

Run Time error 5922
Word was unable to open the data source

What am I doing wrong?

Here is my code:

Dim strEmp As String
strEmp = "001"
Set objWord = GetObject("C:\ProjectGoWest\RedLetter1.doc",
"Word.Document")
objWord.Application.Visible = True
objWord.MailMerge.OpenDataSource _
Name:="C:\ProjectGoWest\GoWest.mdb", _
LinkToSource:=True, _
Connection:="QUERY Works", _
SQLStatement:="SELECT * FROM Works WHERE Recip = '" & strEmp & "'"
objWord.MailMerge.Execute




Thanks
 
A

Albert D. Kallal

Hum, just looking at what you have, it seems to be ok.

If you want, you can grab my sample mail merge code. It allows you merge the
ONE record you are looking at in any form. Further, you only need to place
ONE line of code behind the button to make this merge. And, even better,
there is NO hard coding of the word document location either.

Try the sample word merge example, and likely it will do what you want! Feel
free to use it:

http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top