Question Disable F11 and Shift in Access 2007 database

cpremo

Registered User.
Local time
Yesterday, 17:35
Joined
Jun 22, 2007
Messages
50
I use to have code that would disable the holding down the "Shift" key to access the database struction and the F11 key function. Now that I've purchased Office 2007, this function doesn't seem to work anymore.

Does anyone have code that will do this for Access 2007?
 
has anyone fiqured out how to do it, I have the same problem!!!!!
 
I have a database that some one created. I'll try to post it or send it tonight or tomorrow.
 
You dont really need code for this. Just click the ms symbol in the top left corner of access, go to access options, and find "disable special keys". Just uncheck the box. ;)

If you only want shift and f11 disabled, its a little more complicated, but a little google search should help.
 
Actually, I just retested my code and it is now working. Go figure! So first copy and rename your database "Make MDE Version.mdb". Then, make your changes as required. And click the MS symbol in the top left corner of access, go to access options, find "disable special keys", and uncheck the box.

Then run this code. Then create an ACCDE version of the database.

Code:
Option Compare Database
Option Explicit
'**********************************************************************************************
'*        WARNINING THIS FUNCTION WILL DISABLE THE SHIFT KEY BYPASS!!!!
'* Purpose:  This Function is used to lock down the database so the "Shift" bypass function
'*                won't work.
'*
'* Process:  This function looks at the database's name to ensure it is the "Make MDE Version"
'*                before implementing the setting changes.
'*
'*                Therefore, you must make a copy of your database and name it "Make MDE Version" before
'*                it will work. This ensure that you don't accidently
'*                apply the setting changes on your development database.
'*
'* Last Updated: August 03, 1999  By: Chris Premo
'**********************************************************************************************
Sub SetBypassProperty()
    Dim db As Database
    Dim Prop As Property
    Const conPropNotFound As Integer = 3270
    Set db = CurrentDb()
    Dim dbName As String
    dbName = Right(db.Properties![Name], 20)
    If dbName <> "Make MDE Version.mdb" Then
        MsgBox "STOP!!  DONT RUN THIS FROM THE DEVELOPMENT COPY!!", vbCritical
    Else
        Const DB_Boolean As Long = 1
        ChangeProperty "AllowBypassKey", DB_Boolean, False
        Call DisableSpecialKeys
        MsgBox "THE DATABASE HAS BEEN LOCKED!  IF YOU FORGOT TO DO SOME CHANGES AND GET LOCKED OUT, JUST RE-COMPACT THE MASTER TO THIS COPY!", vbCritical
    End If
End Sub
Function ChangeProperty(strPropName As String, varPropType As Variant, _
    varPropValue As Variant) As Integer
    Dim dbs As Object, prp As Variant
    Const conPropNotFoundError = 3270
    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True
Change_Bye:
    Exit Function
Change_Err:
    If Err = conPropNotFoundError Then ' Property not found.
        Set prp = dbs.CreateProperty(strPropName, _
            varPropType, varPropValue)
        dbs.Properties.Append prp
        Resume Next
    Else
        ' Unknown error.
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function
Function DisableSpecialKeys() As Boolean
On Error GoTo Err_DisableSpecialKeys
Dim db As Database
Dim Prop As Property
Const conPropNotFound = 3270
Set db = CurrentDb()
db.Properties("AllowSpecialKeys") = False
Set db = Nothing
DisableSpecialKeys = True
Exit_DisableSpecialKeys:
    Exit Function
Err_DisableSpecialKeys:
    If Err = conPropNotFound Then
        'If the property doesn't exist, create it
        Set Prop = db.CreateProperty("AllowSpecialKeys", dbBoolean, True)
        db.Properties.Append Prop
        Resume Next
    Else
        MsgBox "Disable did not Work!!"
        DisableSpecialKeys = False
        Resume Exit_DisableSpecialKeys
    End If
End Function
 

Users who are viewing this thread

Back
Top Bottom