FYI: I finally came up with a solution. It works great. Thought I would
share in case anyone else ever needs this.
Debbie
Private Sub cmdEnvelopes_Click()
Application.Echo False 'turn off screen repainting
DoCmd.Hourglass True 'display the hourglass icon instead of
normal mouse pointer
'outputs the data in qryPrintEnvelopes to c:\MergeDate.rtf
DoCmd.OutputTo acOutputQuery, "qryPrintEnvelopes", acFormatRTF,
"c:\MergeData.rtf"
Dim wrdApp As Word.Application 'hold the reference
Set wrdApp = New Word.Application 'will open new session of Word
'opens MediaRelationsEnvelopes.doc which has an AutoOpen macro
'that uses the MergeData.rtf for the merge data, prints the merge, and
closes Word
wrdApp.Documents.Open "c:\My Documents\Training\UMKC\Media
Relations\MediaRelationsEnvelopes.doc"
DoCmd.SetWarnings False 'set system messages off
Set wrdApp = Nothing 'release the reference
Application.Echo True 'turn on screen repainting
DoCmd.Hourglass False 'display normal mouse pointer
DoCmd.SetWarnings True 'set system messages on
End Sub
-----Original Message-----
From: PCSOFT - Personal Computer software discussion list
[mailto:[log in to unmask]]On Behalf Of DebbieG
Sent: Wednesday, March 06, 2002 2:06 PM
To: [log in to unmask]
Subject: [PCSOFT] Access 2000 and Word 200 help
Here's the scenario:
I have a Word document set up to be a mail merge with the data coming from
an Access database.
In this same Access database, I have a form with a command button on it that
opens this Word document. The Word document has an AutoOpen macro that
automatically sends the merge to a printer and then closes Word so that I
can return to the form.
It works well except I get the following message:
The database has been placed in a state by user ** on machine ** that
prevents it from being opened or locked.
It prints the Word file and then it closes my Access database.
I'm assuming it does this because the data is coming from the same database
that I already have open. Do I need to open another session of Access in
order for this to work properly? If so, it sounds like this would take a
lot of memory with Word open and 2 sessions of Access and anything else the
user might have open. Or does anyone have any suggestions on how to get
this work? It works like a charm except for closing my database -- which
isn't very charming.
Thanks in advance for any help.
Debbie Grabb
Do you want to signoff PCSOFT or just change to
Digest mode - visit our web site:
http://freepctech.com/pcsoft.shtml
The NOSPIN Group is now offering Free PC Tech
support at our newest website:
http://freepctech.com
|