Mail Merge With Word Causes 2nd Instance of Access to Open
From: Harrison, Larry
Sent: Thursday, February 08, 2001
11:23 AM
To: 'larrytucaz@mindspring.com'
Subject: MS
Access:2nd instance of DB opens during Word MailMerge
Hi. Any help with this much
appreciated.
I have a form in an Access2000 database. One of
the command buttons on the form opens a mail merge document in Word, using the
following code:
* * * * * * *
Private Sub
Command52_Click()
On Error GoTo
Command52_Err
Dim objWord As
Word.Application
Set objWord = New Word.Application
DoCmd.Hourglass True
DoCmd.RunCommand
acCmdSaveRecord
objWord.Documents.Open
"G:\Steve\database\templates\2SinBins.doc" objWord.Visible =
True
Command52_Exit:
DoCmd.Hourglass
False
Exit Sub
* * * * * * * * *
The data
source of the mail merge document is a query, which uses criteria from data on
the form. Therefore, I need Word to use the already open database, with
the already open form at a particular record. This works fine, under the
circumstances of opening the database initially by holding the Shift key to
bypass Startup. However, I want to use Startup options to hide the
database window, specify a form to open at startup, etc. When I open the
database "normally", allowing the startup options, and then try to link to my
mail merge document as above, a second instance of Access and the database is
opened, which Word unsuccessfully tries to use for its merge
data.
Hope I've explained the situation clearly enough.
Anyone have an idea what's going on?
- Steve.
Hi Allen, Just some coding idea on the
subject... http://www.mvps.org/access/bugs/bugs0011.htm On
Thu, 08 Feb 2001 12:00:48 +0800, Allen
Browne <abrowne@odyssey.apana.org.au> wrote: >Hi Steve. > >Word has always been pretty
unreliable at firguring out that >Access is already open. In some
cases it has even opened multiple >new instances for a
merge. > >One thing that seems to help is to leave the app.
title bar at the >default (so it reads "Microsoft
Access". --------- Pedro Gil http://www.geocities.com/pmpg98_pt |