How to restrict users to open a mdb file in design mode

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bibek24
    New Member
    • Sep 2008
    • 18

    How to restrict users to open a mdb file in design mode

    Hi,

    We have an access application which is accessed through Citrix.
    After providing user id and password, if a user clicks 'OK' button of the login screen with holding 'SHIFT' key, the application opens in Design mode which is not secured.

    Just wanted to know is there any way to overcome this?
    Any properties of the mdb file that we need to enable?
    Any code to be written?

    Please let me know.
  • beacon
    Contributor
    • Aug 2007
    • 579

    #2
    I've never used this method, but I found something that might help you out on Microsoft's website. It traps the mouse event and also has an option to test for the behavior of the shift, alt, or ctrl keys when a button on the mouse was pressed.

    http://http://msdn.microsoft.com/en-...ffice.11).aspx

    You should be able to trap the shift + mousedown event (over the 'OK' command button) and cancel the event once it's fired to prevent the db from opening in design mode or displaying the database window...whatev er the case may be.

    Comment

    • bibek24
      New Member
      • Sep 2008
      • 18

      #3
      Hi Beacon,

      Is the link working for you.I am not able to open it.Could you please check and send me the correct link if it is incorrect.

      Comment

      • nico5038
        Recognized Expert Specialist
        • Nov 2006
        • 3080

        #4
        Here a very sophisticated way to handle this:
        Disabling the Shift Bypass Key in Microsoft Access | Database Solutions for Microsoft Access | databasedev.co. uk

        The bottom line is that you need to manage the "AllowBypassKey ", but by disabling it you're also disable yourself to open the .mdb in design mode.
        So you can keep a backup copy without the option to be able to maintain the .mdb in the future, or use a mechanism as in this code sample to allow access to the design mode again.

        Nic;o)

        Comment

        • beacon
          Contributor
          • Aug 2007
          • 579

          #5
          The link has two http:// in it. Delete one of them in the address bar and it should work.

          I'd probably check out Nico's link. He's been doing this a lot longer than I have and is always a wealth of information.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            Originally posted by bibek24
            Hi,

            We have an access application which is accessed through Citrix.
            After providing user id and password, if a user clicks 'OK' button of the login screen with holding 'SHIFT' key, the application opens in Design mode which is not secured.

            Just wanted to know is there any way to overcome this?
            Any properties of the mdb file that we need to enable?
            Any code to be written?

            Please let me know.
            There are 2 simple steps to Disable the SHIFT ByPass:
            1. Copy and Paste the following Function to a Standard Code Module
              Code:
              Public Function ChangeProperty(strPropertyName As String, varPropertyType As Variant, varPropertyValue As Variant) As Integer
              Dim MyDB As DAO.Database
              Dim MyProperty As DAO.Property
              
              Set MyDB = CurrentDb()
              
              On Error GoTo Err_ChangeProperty
              'Property exists, so set its Value
              MyDB.Properties(strPropertyName) = varPropertyValue
              ChangeProperty = True
              
              Exit_ChangeProperty:
                Exit Function
              
              Err_ChangeProperty:
              If Err.Number = 3270 Then       'Property not found
                'Since the Property isn't found, create it!
                Set MyProperty = MyDB.CreateProperty(strPropertyName, varPropertyType, varPropertyValue)
                MyDB.Properties.Append MyProperty
                Resume Next
              Else
                'Unknown Error
                ChangeProperty = False
                Resume Exit_ChangeProperty
              End If
              End Function
            2. Call the Function Disabling the use of the SHIFT ByPass
              Code:
              Dim intRetval As Integer
              
              'Don't allow the use of the SHIFT ByPass Key
              intRetval = ChangeProperty("AllowBypassKey", dbBoolean, True)

            P.S. - Be sure to include the Error Handling code!

            Comment

            Working...