By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,351 Members | 1,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,351 IT Pros & Developers. It's quick & easy.

Opening a mail doc from Access - code problem

P: n/a

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
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

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I found your question while trying to find an answer to the same
thing. I could not find much in the way of help for the linking to
the table or query from the word document. All solutions came to the
same result. It only opened the document.

I played with another example and found that this works

Dim retVal
retVal = Shell("WINWORD.EXE " & varFolder &
"Documents\NewsletterLabel.doc", vbMaximizedFocus)
I hope it helps you.

Don Byrne

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.