Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    London
    Posts
    326

    Question Disable SHIFT + OPEN

    Hi guys,

    Is there a way to disable people opening my access for design by holding the shift when opening the database without securing the database?

  2. #2
    Join Date
    Jun 2004
    Posts
    92

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    I found this Text somewhere. It will help you out (I hope )

    Disable Shift-Key ByPass

    Preface: if you hold down the SHIFT key when loading up a database, any startup options you have are bypassed. If you have a database geared towards an end-user, you may wish to prevent this from happening--say, to prevent them from going to your source data tables.
    The steps to bypass this "back door":
    First off, always do this to a copy of the database; that way, you (the designer) always have a way in
    Create a new module, with the following code
    Code:
    Public Sub SetBypassProperty()
    	Const DB_Boolean As Long = 1
    	ChangeProperty "AllowBypassKey", DB_Boolean, False
    	' To re-enable shift bypass change the above line to True, hold down CTRL-G and in the ensuing window type
    	' Call SetBypassProperty
    End Sub
     
    Private 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
    Save the module with a meaningful name like mod_Disable_Shift_Key (do not name it "AllowByPassKey")
    Compile/save the module
    Open the debug window by typing CTRL-G
    In the ensuing window that opens, type Call SetBypassProperty
    Close and save the module
    Next time you start this database up, you will notice that holding down the shift key no longer bypasses any startup options.
    How to Go Back to Allowing ByPass
    It's always smart to keep a backup copy of the database that does not have the shift key disenabled. Nonetheless, if you are able to manipulate your way to the database window and can edit the module, then you can undo the bypass as follows:
    Open the module in design view
    Change the line ChangeProperty "AllowBypassKey", DB_Boolean, False to ChangeProperty "AllowBypassKey", DB_Boolean, True.
    Compile the module
    Open the debug window (CTRL-G)
    Type the following line in the ensuing window: Call SetBypassProperty
    Close & save the module


  4. #4
    Join Date
    Oct 2003
    Location
    London
    Posts
    326
    EXCELLENT:

    This is excellent for blocking access!

    I have put this code into the database and to get to the desiging side of this, I have allowed special access keys on the startup options so that people can get the VB code (passworded) and disable this.

    Its a long process of unlocking then closing then opening then modifying then locking then closing... again and again but it works to secure this.

    Thanks, pal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •