From: InvisibleDuncan on
I have an Access 97 database that has an autoexec macro that runs every time
it's opened. However, it's also running every time my users open a Word
document that has a mail-merge from the database. Is there a way for Access
to know that it's been opened by Word and therefore not run the Autoexec
macro?

Thanks...
From: Stefan Hoffmann on
hi,

On 21.04.2010 11:32, InvisibleDuncan wrote:
> I have an Access 97 database that has an autoexec macro that runs every time
> it's opened. However, it's also running every time my users open a Word
> document that has a mail-merge from the database.
The AutoExec macro should only be run when the database is opened in
Access. A normal mail-merge should only read data from the database file.

> Is there a way for Access
> to know that it's been opened by Word and therefore not run the Autoexec
> macro?
No.

I would consider creating a second front-end for the mail-merge without
AutoExec macro.


mfG
--> stefan <--
From: Paul Shapiro on
"InvisibleDuncan" <InvisibleDuncan(a)discussions.microsoft.com> wrote in
message news:9E8F1C94-A514-4963-8D69-402B21290067(a)microsoft.com...
> I have an Access 97 database that has an autoexec macro that runs every
> time
> it's opened. However, it's also running every time my users open a Word
> document that has a mail-merge from the database. Is there a way for
> Access
> to know that it's been opened by Word and therefore not run the Autoexec
> macro?

If you are explicitly starting Access from Word, you could use a
command-line parameter and have your AutoExec macro quit based on the
command line parameter value. Here's an example from a command file I've
used to start Access:
Start "MyWindowTitle" "C:\MyFolder\MyDB.mdb" "/cmd: /ReadOnlyForms"

From: InvisibleDuncan on
"Stefan Hoffmann" wrote:

> The AutoExec macro should only be run when the database is opened in
> Access. A normal mail-merge should only read data from the database file.
>

That's what I would have thought. As far as I'm aware it's just a standard
mail-merge - we certainly haven't done anything fancy - but it actually
opens an instance of Access alongside Word.
From: InvisibleDuncan on
"Paul Shapiro" wrote:
> If you are explicitly starting Access from Word, you could use a
> command-line parameter and have your AutoExec macro quit based on the
> command line parameter value. Here's an example from a command file I've
> used to start Access:
> Start "MyWindowTitle" "C:\MyFolder\MyDB.mdb" "/cmd: /ReadOnlyForms"
>
Unfortunately, we don't explicitly open the database - we just use Word's
built-in mail-merge functionality. There doesn't seem to be any scope in
there for using command line switches.