Auto Exec File

G

Guest

I have a small database that I am ready to set up for the user. Right now
when the user opens the database, it comes up to a start up screen with the
database window closed. I would like to disable the shift key. How do I get
the disable shift key code to run before the startup screen? I think I need
to make an autoexec macro, but there again not sure what to put in it or how
to get it to run before the user has a change to use the shift. Forgive my
ignorance!

Thanks for any help!
 
G

Guest

To my knowlege you can not disable a Keystroke globally. This will take some
programming in each for to disable the Keystroke. In each form you will need
to set the Key Preview to Yes and then set each OnKeyDown set the appropriate
KeyCode or Shift to 0.

Example:
Private Sub Form_KeyDown(Keycode as integer, Shift as Integer)
if(Shift = 2) then Shift = 0 'Disables Ctrl down
If(Shift = 4) then Shift = 0 'Disables Alt down
exit sub
 
G

Guest

Thanks for your prompt response!! Let me explain a little better. I want to
disable the shift key so that the user can't open the database window. So
maybe I'm not saying that quite right. I want to make the database so that
the user can't get into the code and stuff. I will make it a mde file, but I
also want to disable the shift key so that they can't bypass the startup
screen. Hope this makes more sense!!
 
G

Guest

Sorry, but Devin's response is incorrect. You can do what you want to do.
Look in VBA Help for the AllowBypassKey property. There is an example there
that will show you how this is done.
 
G

Guest

Thanks for the response, I have looked at the VBA help and I think I can
figure it out. However I'm still unsure where to put the code. If I put it
in the "on load" event of the startup form, the user can still bypass it by
holding the shift. I'm missing the step it takes to open the database and
run the bypass shift key property before it opens the startup form. Thanks
again for your help.

at
 
G

Guest

The first time you open a database and run the code. Then you close the
database. From then on, when you open the database, the shift key will be
ignored. The load event of the form you identify to open on start up is the
correct place to put the code.

Now, one thing to be aware of, once set, you will never be able to use the
shift key to bypass startup unless you have some method for enabling the
shift key. A trick to accomplish that is to have a command button or menu
bar somewhere that will allow you to reset it. If you are using security,
you can set it up so that only admins can run the code to enable it. If not,
you can put a password in the code to allow authorized people to execute it.
But, remember, it does not affect the current session. You have to close and
reopen for either enabling or disabling to take effect.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top