I have set up a mail merge document and I can run a query and then follow the link of the document through my computer and open the mail merge document and it asks me do I want to run the SQL command and thats fine. I click yes and everything is fine.

However when I create a seperate form and and a command button to automate it, the problems start.



The code I use is:



Code:
DoCmd.OpenQuery "qryPrintLetter"

 

Dim appWord As Object

 

Set appWord = CreateObject("Word.Application")

appWord.Visible = True

 

Dim objDoc As Object

Set objDoc = appWord.Documents.Open("C:\Databases\Access Databases\MergeLetters")

The query 'qryPrintLetter' updates value in in a table called 'TempMembers' which the document mail merges with. When you click the command button to perform this code it opens the word document but the names and address dont appear. It also doesnt ask you if you want to perform the mail merge SQL query.



Any help would be greatly appreciated.

Thanks.