Problems opening a mailmerge document from Access

A

Andy Davis

Hi

I've written the following code for a button on a form to open a mail merge
document in MS Word. The code opens the document fine but does not display
the usual connection details to open the table in my database when the file
is opened.i.e:
"Opening this document will run the following SQL command:
SELECT * FROM 'filename' "
Hence all that is opened is a document with no updated details from the
source table. If I open the document directly in Word it works OK.

-----------------------------------
VBA Code in Access form:

On Error GoTo Err_SettLett_Word_Click
'declare variables
'object variable that refers to Word
Dim appWord As Object

'Word.Application data type established from reference to Word's object
library
Set appWord = CreateObject("Word.Application")
'make Word visible
appWord.Visible = True

'Open Word document
With appWord
.Documents.Add "C:\DD\Database work\GCRE\settlement_lett.doc"
End With

----------------------------------

Any help much appreciated.

Thanks in advance

Dawn
 

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