By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,939 Members | 611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,939 IT Pros & Developers. It's quick & easy.

Disabling the bypasskey using VBA code

P: 1
i want to know how to disable the access shift key using VBA Code
Oct 21 '17 #1

✓ answered by ADezii

  1. Function Definition (disables SHIFT ByPass):
    Expand|Select|Wrap|Line Numbers
    1. Private Function ChangeProperty(strPropertyName As String, varPropertyType As Variant, varPropertyValue As Variant) As Integer
    2. On Error GoTo Err_ChangeProperty
    3. Dim MyDB As DAO.Database
    4. Dim MyProperty As DAO.Property
    5.  
    6. Set MyDB = CurrentDb()
    7.  
    8. 'Property exists, so set its Value
    9. MyDB.Properties(strPropertyName) = varPropertyValue
    10. ChangeProperty = True
    11.  
    12. Exit_ChangeProperty:
    13.   Exit Function
    14.  
    15. Err_ChangeProperty:
    16.   If Err.Number = 3270 Then       'Property not found
    17.     'Since the Property isn't found, create it!
    18.     Set MyProperty = MyDB.CreateProperty(strPropertyName, varPropertyType, varPropertyValue)
    19.     MyDB.Properties.Append MyProperty
    20.       Resume Next
    21.   Else
    22.    'Unknown Error
    23.    ChangeProperty = False
    24.      Resume Exit_ChangeProperty
    25.   End If
    26. End Function
  2. Sample Function Call to Disable SHIFT Key:
    Expand|Select|Wrap|Line Numbers
    1. ChangeProperty "AllowBypassKey", dbBoolean, False

Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,623
  1. Function Definition (disables SHIFT ByPass):
    Expand|Select|Wrap|Line Numbers
    1. Private Function ChangeProperty(strPropertyName As String, varPropertyType As Variant, varPropertyValue As Variant) As Integer
    2. On Error GoTo Err_ChangeProperty
    3. Dim MyDB As DAO.Database
    4. Dim MyProperty As DAO.Property
    5.  
    6. Set MyDB = CurrentDb()
    7.  
    8. 'Property exists, so set its Value
    9. MyDB.Properties(strPropertyName) = varPropertyValue
    10. ChangeProperty = True
    11.  
    12. Exit_ChangeProperty:
    13.   Exit Function
    14.  
    15. Err_ChangeProperty:
    16.   If Err.Number = 3270 Then       'Property not found
    17.     'Since the Property isn't found, create it!
    18.     Set MyProperty = MyDB.CreateProperty(strPropertyName, varPropertyType, varPropertyValue)
    19.     MyDB.Properties.Append MyProperty
    20.       Resume Next
    21.   Else
    22.    'Unknown Error
    23.    ChangeProperty = False
    24.      Resume Exit_ChangeProperty
    25.   End If
    26. End Function
  2. Sample Function Call to Disable SHIFT Key:
    Expand|Select|Wrap|Line Numbers
    1. ChangeProperty "AllowBypassKey", dbBoolean, False
Oct 21 '17 #2

Rabbit
Expert Mod 10K+
P: 12,357
Be aware that anyone can run a similar thing to undo the bypass.
Oct 22 '17 #3

NeoPa
Expert Mod 15k+
P: 31,419
While that's certainly true, not so many people would be able to work out how if they don't have easy access to where they can run code from.

Other settings do come into play of course but with it locked down as much as possible it takes someone who understands Access pretty well to break in.

Clearly there are many of us around, but there are also many for whom these steps will suffice to keep them out.
Oct 30 '17 #4

Post your reply

Sign in to post your reply or Sign up for a free account.