T
Tim
How would one write VB code (in a stand-alone app) to create a new
macro in an Access dB?
I know you all will ask why would I want to do that, so here are my
reasons...
My VB app is currently in production and there are hundreds of copies
in customers' hands. It ships with and uses 3 Access databases.
Several customers have complained that their employees can open the
databases using MSAccess. They want to prevent this.
One method is to add an AutoExec macro in the databases with a single
action: "Quit." I can also disable the Shift bypass key.
This is fine for all new shipments of my databases to new customers.
However, existing customers need to update their databases to add this
macro. My boss says we can't ask a customer to manually add this macro
themselves - I need to write an "update" program that will do it
automatically for them.
I can easily write a VB program to set the "AllowBypassKey" property to
"True," but how would this same program add the AutoExec macro to the
existing database?
I thought about providing a plain empty database with nothing in it
except for the macro, then using DoCmd.CopyObject or
DoCmd.TransferDatabase, but both of these require opening the source
database as an Access Application - but when it opens, the AutoExec
macro in it closes it! (DUH!)
If there's no way to create/copy/import a new macro, does anyone have
any other ideas?
-- I also posted this to microsoft.public.access --
macro in an Access dB?
I know you all will ask why would I want to do that, so here are my
reasons...
My VB app is currently in production and there are hundreds of copies
in customers' hands. It ships with and uses 3 Access databases.
Several customers have complained that their employees can open the
databases using MSAccess. They want to prevent this.
One method is to add an AutoExec macro in the databases with a single
action: "Quit." I can also disable the Shift bypass key.
This is fine for all new shipments of my databases to new customers.
However, existing customers need to update their databases to add this
macro. My boss says we can't ask a customer to manually add this macro
themselves - I need to write an "update" program that will do it
automatically for them.
I can easily write a VB program to set the "AllowBypassKey" property to
"True," but how would this same program add the AutoExec macro to the
existing database?
I thought about providing a plain empty database with nothing in it
except for the macro, then using DoCmd.CopyObject or
DoCmd.TransferDatabase, but both of these require opening the source
database as an Access Application - but when it opens, the AutoExec
macro in it closes it! (DUH!)
If there's no way to create/copy/import a new macro, does anyone have
any other ideas?
-- I also posted this to microsoft.public.access --