• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

start up code that runs in MS Access

I would like to have code run on the start up of a database but do not want the user to be able to disable the action by holding down SHIFT.  I know I can disable the SHIFT key but still would like to know if it is possible if there is a place code can run without the SHIFT ket impacting it.  ~ Thanks
0
marku24
Asked:
marku24
3 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
IF you Disable the Shift Key Bypass, then no startup will occur, because an AutoExec macro will not execute nor will any Form be  loaded.

And regarding Shift Key ... see this ... it's very cool:

The link below contains an MDB which allows you to 'set' and 'reset' the Shift Key Bypass from a REMOTE mdb.  
It's very cool. Scroll down the page to 'By Pass Shift Key Code'
And it works in A2010 also.
http://www.kallal.ca/msaccess/msaccess.html

mx
0
 
Jim Dettman (Microsoft MVP/ EE MVE)PresidentCommented:
<<IF you Disable the Shift Key Bypass, then no startup will occur, because an AutoExec macro will not execute nor will any Form be  loaded.>>

  Think mx meant to say this a bit differently; with the shift key bypass disabled, a user cannot stop the autoexec or startup form from running.

  If the shift key bypass is enabled, then a user can stop the autoexec or startup form from running by holding down the shift key.

  But note that if you have a savey user, they can use the code that mx pointed to and re-enable the bypass and bypass your startup.

Jim.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Yeah ... no coffee yet ... bad idea to post under that condition!  

At the end of the day (after a lot of coffee), there is no fool proof way to keep a user from doing things. You can create an MDE (ACCDE) to protect your code, put on a database password and mess with the Shift Key ... but nothing is fool proof.

mx
0
 
Nick67Commented:
<nothing is fool proof>
That is true enough.  In the end, you can make things incredibly inconvenient for someone.
Hide the Dtabase Wndow/ Nav Pain
Open a hidden form with your autoexec.
In the OnOpen() event of every object, check if that hidden form is open, if not Application.Quit
Make the file into an ACCDE, rename it to an ACCDR.
In the OnOpen() event of every object, check if the application is in runtime mode, if not Application.Quit.

That doesn't prevent anyone from creating a new db, and either linking or importing tables from the locked down one.
But it makes life tough.
And you have to be very careful that you don't lock yourself out!
0
 
marku24Author Commented:
Isn't the answer I was looking for but it is what it is. ~ Thanks everyone
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now