Solved

start up code that runs in MS Access

Posted on 2011-09-27
5
356 Views
Last Modified: 2012-05-12
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
Comment
Question by:marku24
5 Comments
 
LVL 75
ID: 36710741
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
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 84 total points
ID: 36710817
<<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
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 83 total points
ID: 36710860
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
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 83 total points
ID: 36711005
<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
 

Author Closing Comment

by:marku24
ID: 36711122
Isn't the answer I was looking for but it is what it is. ~ Thanks everyone
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question