How to change Shift key by another key to open file access

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alias90
    New Member
    • Jul 2012
    • 23

    How to change Shift key by another key to open file access

    Hi everybody!
    As You know, we can open the design view in access by hold Shift key and Open. However, I want to prevent users open my file access in design view.
    Please help me create function to change the Shift key by another key. Thanks for assistance!
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    You can run this bit of code from any other access database:
    Code:
    Public Sub DisableShiftKeyBypass(strDB As String, bEnabled As Boolean)
         
       Const conPropNotFound = 3270
    
       On Error GoTo err_Handler
       
       
       Dim db As DAO.Database
       Set db = OpenDatabase(strDB)
             db.Properties("AllowByPassKey") = bEnabled
       db.Close
       Set db = Nothing
       Exit Sub
    
    err_Handler:
       If Err.Number = conPropNotFound Then
          Dim prop As DAO.Property
          Set prop = db.CreateProperty("AllowByPassKey", dbBoolean, bEnabled)
          db.Properties.Append prop
          Resume Next
       Else
          MsgBox "Procedure [DisableShiftKeyBypass] was not succesfull" & vbNewLine & Err.Number & Err.Description
       End If
       
    End Sub
    This will disable or enable the shift bypass key.

    Note that it is just as easy for another user with the same or similar code to re-enable it. This is simply to prevent the average nosy user from getting to the backstage.

    You can make access difficult to get too, but making it 100% secure is not possible. In most cases where access is used it also is not necessary.

    Comment

    • Alias90
      New Member
      • Jul 2012
      • 23

      #3
      Thank for assitance !!
      But i want to change Shift key by another key. just only the owner can open it. i tried on some functions disable Shift in internet.Howeve r, if users is good person in access , they stell can enable SHift by function .That reason I want to change the another key replace Shift key.Please help me. Thanks a lot of!!!!!

      Comment

      • TheSmileyCoder
        Recognized Expert Moderator Top Contributor
        • Dec 2009
        • 2322

        #4
        You cannot completely disable it, in such a way as it can't be re-enabled.

        You can compile your code, and release it as a MDE/ACCDE, with keyboard shortcuts disabled, and navigation pane hidden, and the shift key disabled. You can add password protection to your modules, but access will never be 100% safe.

        Comment

        • Seth Schrock
          Recognized Expert Specialist
          • Dec 2010
          • 2965

          #5
          You can use Access Runtime for those users that don't need administrative access. This takes away all design ability (VBA, Shift+open, navigation pane, etc.). If you are running Access 2010, then Access Runtime 2010 is free. I use this all the time at work. I have one of the only Access licenses while all the users just have Runtime.

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            I haven't used runtime, but wouldn't that only work if they don't have a license for it?

            Comment

            • Seth Schrock
              Recognized Expert Specialist
              • Dec 2010
              • 2965

              #7
              I assume you mean a license for Access? What happens is that you package the database which creates an installation file with a .accdr extension which defaults to open with Runtime even if Access is installed. I'm not sure if Access can even open a .accdr file or not. The only issue with runtime is that all ribbon bar (Access 2007 & 2010) controls are gone. If you need certain abilities (copy, cut, paste, etc.) in the ribbon bar, they must be added manually.

              Comment

              • TheSmileyCoder
                Recognized Expert Moderator Top Contributor
                • Dec 2009
                • 2322

                #8
                As I said, no real experience with runtime but I believe I heard that you can simply rename the filetype accdb and you are back in business. That might just be my mind going though.

                Comment

                • Seth Schrock
                  Recognized Expert Specialist
                  • Dec 2010
                  • 2965

                  #9
                  I just tested your theory and you are correct. Renaming it does get you past the security.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32662

                    #10
                    Originally posted by Alias90
                    Alias90:
                    But i want to change Shift key by another key. just only the owner can open it.
                    The Bypass Key (Shift) is inbuilt into the Access (and all Office) application. Unless you join the MS Access development team you won't be able to manage that.

                    If you disable the Bypass key for your project though, you could add some code to check for another key as the first code to run in the form that is set to open by default when the project is started. If the key is detected at that point then the code could stop and this would give a very similar result to the Bypass key.

                    Comment

                    • Alias90
                      New Member
                      • Jul 2012
                      • 23

                      #11
                      Thanks NeoPa a lot of!!!

                      Comment

                      • TheSmileyCoder
                        Recognized Expert Moderator Top Contributor
                        • Dec 2009
                        • 2322

                        #12
                        How to change Shift key by another key to open file access

                        Just because you can code your own sort of "shift" functionality, just remember that you are not going to remove the ability of someone else to re-enable the shift. You can set a password on your entire DB which means the user must have the password to disable the shift. This however also means the user must have the password to use the database, so you are pretty much back to start.
                        Last edited by NeoPa; Oct 15 '12, 11:10 PM. Reason: Removed parts related to other topic.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32662

                          #13
                          @Alias90
                          You're welcome :-)

                          A new thread was created to handle the topic of discussion that grew from this one. It can be found at Discussion: Comments on Alternative Bypass Key.
                          Last edited by NeoPa; Oct 15 '12, 11:12 PM. Reason: Added link.

                          Comment

                          • Alias90
                            New Member
                            • Jul 2012
                            • 23

                            #14
                            Thanks everybody a lot of! a new thread is great! I hope we have more and more good threads for us who are newbie in access to improve our exp

                            Comment

                            Working...