open word document

S

Sam

I have the following code which opens a word document from MS Access 2003:

Dim LWordDoc As String
Dim App As Object

'Path to the word document
LWordDoc = "c:\ServerBackup\rptBUMC HxP.doc"

If Dir(LWordDoc) = "" Then
MsgBox "Document not found."

Else
'Create an instance of MS Word
Set App = CreateObject(Class:="Word.Application")
App.Visible = True

'Open the Document
App.Documents.Open filename:=LWordDoc
End If

The document is a mail merge document set up that way so I can populate it
with various data from my database. When I open the document, the underlying
query that populates the Word document (from MS Access) does not update. If I
open the document directly from Word, the query updates. Furthermore, if I
manually refresh the query in Access, the Word document still doesn't
refresh: it keeps the old data. How can I correct this?

Sam
 

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