Disable Shift Key

KeithWilliams

Registered User.
Local time
Today, 22:45
Joined
Feb 9, 2004
Messages
137
Disable Shift Key - Sorry

Hi,

I know there are numerous threads on this but I can't make ghudson's solution (http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=36043) work for me.

I'd like to open the application, preventing the shift key from bypassing startup, unless the user id equals a particular value (say my id). I don't want a splash screen or logon, as the application relies on the user's windows login as the basis of security. Currently the application opens without an initial form, just a custom toolbar from which they select the function they want.

OK, I'll settle for having a splash screen if its the only way, but I created one and selected it in the startup options, but of course holding down the shift key bypasses the startup options and the form doesn't even open!

Somewhere I need to put the code to disable the shift key, or else close the database window, but where?

Thanks and sorry for posting on such an oft-repeated subject!
Keith.
 
Give the code in the attached file a try. You should be able to copy and paste it without making any alterations.

What it does is test whether the file is an mde file or mdb. If it's mdb then it unlocks everything. If it's mde it locks everything down.

How I call it is create a macro called autoexec and the first line of the macro is RunCode (SetDbProperties())

You won't need a splash form for it.

When you first create an mde file and open it nothing will be locked down because it's just locking it down for the first time. Just close it an reopen and it will be locked.
 

Attachments

Hi Rob,

That did the trick, thank you so much!

I think your solution is similar to something I tried earlier, but I adopted the idea of only the MDE being protected, but adding a back-door for me to get in (as I will still need to debug the MDE).

I couldn't get it to work initially, but found that the problem was I'd referenced CurrentDB directly, rather than assigning it to a variable. I'm not sure why that makes a difference, but when I used the variable as per your example, it worked fine.

Many thanks,
Keith.
 

Users who are viewing this thread

Back
Top Bottom