VBA code instead of Autoexe macro?

  • Thread starter Thread starter Alp Bekisoglu
  • Start date Start date
A

Alp Bekisoglu

Hi Experts,

Too many questions recently but, I'd like to do away with the autoexe macro
since it is visible and can be altered in an mde and run the code behind it
via VBA.
A few questions;
Is this feasible/do'able?
Will it do the same trick? i.e. refresh the links, etc.
Is there any specific location the code needs to be put to or being behind
the startup form would suffice?

Thanks in advance.

Alp
 
The sequence of events that you have running in "Autoexec"
should be able to be replicated in VB (E.g. You could
create a Startup Module and run your sequence events from
a function "StartDatabase"). However you will still need
an AutoExec Macro to Run the Startup (Use the 'RunCode'
Macro Function to run the function "StartDatabase").

Although users will still be able to grab the Autoexec
Macro, doing this will only tell them what Function the
Macro runs at Startup.

To remove the Macro altogether, you will need to open a
Form at Startup, that will run the VB code 'Call
StartDatabase' as soon as the Form is opened.

HTH


Tony C
 
Thanks for your reply Tony. So as I understand it, I can put the necessary
initial routines right under the OnLoad event of my StartUp form and do away
with the autoexec macro.
Basically there are a few things that needs to get done;
-Refresh BE links
-A bit of Options tweaking (to rid the annoyance of user confirming each
action query)
-System & Registration controls

The last one is already running under the StartUp form with no hassles. I
don't expect the other two to create any problems as well. Maybe I might
need to put a small delay in enabling the "Continue" button on it to allow
re-linking enough time.

Thanks again and have a good one.

Alp
 
Question: even if you move your startup routines from an AutoExec macro to
behind a Startup form, don't you still have a variation of the same problem?
In an MDE a user can access a macro, true. But they can also "turn off" or
otherwise change the startup form.

If user tampering is an issue you will need to go further: turn off the
database window, special keys, maybe some menus, disable shift, etc. Once
you do that worries about using a AutoExec macro (or a designated Startup
form) come closer to being non-issues.

FYI: I generally use a one line AutoExec macro that calls all my startup
code, including opening my startup forms. I don't rely on the settings
under Tools>StartupForm. (Actually, I reset all Startup options via code
each time my db opens & closes, just to make absolutely sure that I have the
last word.)
 
(snip)
In an MDE a user can access a macro, true. But they can also "turn off" or
otherwise change the startup form.

Not if the relevant startup property was created with the DDL parameter set
to True. Then, only members of the workgroup file that was used to create
the database, can change that property.

HTH,
TC
 
Well I guess I should admit that I was acting a bit paranoiac...
But thanks for all your valuable advices. All duly noted. Actually before
delivery I will be disabling all those "special keys" etc. thus F11 would
not (or should not work) anyway.

Thanks to all of you Tony, TC and George. Its you guys who make this world
bearable.... :-)

Alp
 
Back
Top