Solved

start up code that runs in MS Access

Posted on 2011-09-27
5
353 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now