Link to home
Start Free TrialLog in
Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America

asked on

Turn off Autoexec if need be

I have a group of mdbs, the first mdb runs code the launches the 2nd mdb and launches the autoexec - which imports some tables from an external mdb.  Then the code in my 1st mdb continues to zip the 2nd mdb file and filecopy it -allow the user to copy the zip file to their own pc.

The problems lies with when the user opens the zip file the autoexec on the copied 2nd mdb will still be active,  It is here that I want to deactivate the autoexec on the copied mdb.

Is this possible and if so can you point me in the right direction.

Thanks,

Karen
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Without getting into the specifics of your zip deployment, instead of AutoExec macros you could assign a Startup Form in Tools menu: Startup.  Then, in that form's Open event you could write VBA code that could test for the existance of another instance of Access running, and behave accordingly.

Avatar of Karen Schaefer

ASKER

Thank you for the suggestion, however, this will not work in my case- My original mdb prior to be zipped needs to import the two tables.  If is after the mdb is zipped and is waiting for the user to open the 3mdb that file copies the zip file to their local machine.   It is the copy on the local machine that I need to deactivate the autoexec.

Thanks,

karen
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Capricon,

Thanks,

Sometimes it is the simpliest solution is the best.

Thanks for the great idea.

Karen
U R Welcome!!!
Sorry 1 more question - Where would be the best place to put this so it affects only the copied version and not the original.

Karen
My orignial code has me processing the 2nd mdb and then closing it and then zip the update mdb and then 3rd mdb is opened by user for them to save to their pc.

Should I do a filecopy of the original mdb, reopen the copy - rename the autoexec in that copy and then zip it?

What do you think.

Karen
<Should I do a filecopy of the original mdb, reopen the copy - rename the autoexec in that copy and then zip it?>

right, i think this is the best way of doing this.
I end up not using this - I added a if statement comparing the current filename and if <> to then I ran the autoexec code.

Thanks for the input.

K