Link to home
Start Free TrialLog in
Avatar of Jjuavinett
Jjuavinett

asked on

F11 KEY

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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
disabling the F11 KEY is not good {imho}  i just set the password...
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

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.
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