code do desactivate F11

M

Marco

Hi. I don't want to desactivate the F11 key because I need to access to the
database access windows.

So I would like to only desactive it for the rest of the users.

I have already a code in the Splash form the first one to open that disable
the Menu Bar.

If CurrentUser <> "MPsilva" Then
DoCmd.ShowToolbar "Menu Bar", acToolbarNo
End If

What code should I use to make F11 be not avaible for the rest of the users?

Regards,
Marco
 
R

Robert Morley

You'd be better off asking in an Access group, but the two normal approaches
are to

a) deactivate the special keys using the Startup Options, then re-enable the
same functionality using, for example, DoCmd.SelectObjet acTable, , True;
or
b) deactivate the special keys by default, but have a command-line switch or
special key sequence, etc., that you can use to re-activate them. I
don't remember for sure, but I think this requires a re-start of Access,
so it can be a bit tricky.

It's been a while since I've implemented this kind of things, so I'm a
little foggy on the details. Someone in an Access group will undoubtedly
remember it better than I do.


Rob
 
L

Linq Adams via AccessMonster.com

This code, placed in all forms where you want F11 disabled, will do so for
everyone EXCEPT you, where

YourUserName

is your Windows account name. I don't remember version of Access the Environ()
function first became available in, but I know it works in ACC2003. Someone
may point out that the Environ variable can be reset by a knowledgeable
programmer, which I think is probably true, but of course, they'd have to
know that your disabling of F11 was based on this in order to try to use this
technique to hack around it. All security strategies HAVE to be based on and
take into account who you're trying to secure your database from.

Private Sub form_keydown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF11 'F11 will do nothing
If Environ("UserName") <> "YourUserName" Then
KeyCode = 0
End If
End Select
End Sub

Another similar technique would be to have one form for your personal use,
password protected, and then place this code

Private Sub form_keydown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF11 'F11 will do nothing
KeyCode = 0
End Select
End Sub

on all forms except for your personal form. You could then use F11 from this
form.

Good Luck!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 

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

Similar Threads


Top