F11 KEY

Jjuavinett
Jjuavinett used Ask the Experts™
on
For the longest time I thought I had a level of protection from amateur users to get in behind a switchboard. I de-activated the Shift enter key. I now find that even thought the shift funtion is diabled, hitting the F11 key will bring up the database and allow design view to modify tables queries etc.
Is there code I can write that will dis-able the f11 key yet once dis-abled allow me to re-enable it when I need
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
you can set a password

from VBA window

Tools>DBName  Properties

select the protection tab

click on Lock project for viewing

set the password
Top Expert 2016

Commented:
disabling the F11 KEY is not good {imho}  i just set the password...
Top Expert 2006

Commented:
What u can do is disable it in Tools/Startup

The way round this of course is if u open the database using the SHIFT key

Of course u can prevent this as well, by adding some code

What ive done in the past is to lock it down like this but have something on the switchboard somewhere which when double clicked (like a main menu label) will prompt for a pswd. When entered, it enables shift bypass. I close down and restart DB, all sorted, Im in!!!

Useful when on the user's PC, no additonal s/w required to be installed

11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Commented:
How about only giving your users an MDE (compiled) version of your application.  They shouldn't be able to do anything no matter what they hit since teh MDE doesn't allow modifications.
Top Expert 2006

Commented:
Here is sample code that here is a mixture of enabling/disabling
u can add this to a module somewhere

You will see there is StartupShowDBWindow and AllowBypasskey (the shift I was talking about)

Sub SetFullStartupProperties()
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    ChangeProperty "AllowBypassKey", dbBoolean, True
End Sub


Function ChangeProperty(strPropName As String, _
                        varPropType As Variant, _
                        varPropValue As Variant) As Integer
    Dim prp As Property
    Const conPropNotFoundError = 3270

    On Error GoTo Change_Err
    CurrentDb.Properties(strPropName) = varPropValue
    ChangeProperty = True

Change_Bye:
    Exit Function

Change_Err:
    If Err = conPropNotFoundError Then
        ' Property not found.
        Set prp = CurrentDb.CreateProperty(strPropName, varPropType, varPropValue)
        CurrentDb.Properties.Append prp
        Resume Next
    Else ' Unknown error.
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function




Of course, u dont have to do the bypass, just code it to enable/disable the StartupShowDBWindow bit
This shows how to enable/disable menus and F11 (as Cap says)

http://www.datamouse.biz/Developers_Files/General_Menus.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial