• Reset AllowByPassKey property back to True (A2K/A2K2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Reset AllowByPassKey property back to True (A2K/A2K2)

    Author
    Topic
    #378470

    Can anyone help with the VBA to reset the AllowByPassKey to True.

    Person set it false and left. No back up to be had.

    Need to change Oracle property timeout in query in autoexec macro so ODBC conncetion will not time out.

    TIA.

    Viewing 2 reply threads
    Author
    Replies
    • #626597

      Code from the help is:
      Sub SetBypassProperty()
      Const DB_Boolean As Long = 1
      ChangeProperty “AllowBypassKey”, DB_Boolean, False
      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

      You must create an autokey macro group to select what bypass keys you want to use. I assume whoever created the disable startup method on your database created two autokeys…one to turn bypass on and one to turn bypass off. Do they have a phone where they left to? I’d be calling it.
      NMPadgett

    • #626599

      The ShiftKey property can be set via a remote database.

      Go to the location below and download a Utility that will do what you need.

      ByPass Shift Key Utility

      HTH
      RDH

    • #626637

      Here is some sample code you could use to reset AllowBypassKey property for another database:

      Public Sub SetDbBypass(strDbName As String, bAllowBypass As Boolean)
      On Error GoTo Err_Handler

      ‘bAllowBypass = True – allows use of Shift Bypass Key
      ‘bAllowBypass = False – prevents use of Shift Bypass Key

      Dim db As DAO.Database
      Dim ws As DAO.Workspace
      Dim prop As DAO.Property
      Dim strPropName As String
      Dim strMsg As String
      Dim bValue As Boolean

      Set ws = DBEngine.Workspaces(0)
      Set db = ws.OpenDatabase(strDbName)

      strPropName = “AllowBypassKey”
      db.Properties(strPropName) = bAllowBypass
      bValue = db.Properties(“AllowBypassKey”).Value
      strMsg = strPropName & ” property = ” & _
      bValue & vbCrLf & vbCrLf & _
      “External database:” & vbCrLf & strDbName
      MsgBox strMsg, vbInformation, “SHIFT BYPASS RESET”

      Exit_Sub:
      db.Close
      Set ws = Nothing
      Set db = Nothing
      Set prop = Nothing
      Exit Sub
      Err_Handler:
      If Err = 3270 Then ‘Property not found – create and append
      Set prop = db.CreateProperty(strPropName, dbBoolean, bAllowBypass)
      db.Properties.Append prop
      Resume
      Else
      strMsg = “Error No ” & Err.Number & “: ” & Err.Description
      MsgBox strMsg, vbExclamation, “SET DATABASE BYPASS ERROR”
      End If

      End Sub

      Example of use (provide full path of other database):
      SetDbBypass “C:ACCESSNameOfDatabase.mdb”, True

      NOTE: If the other database is secured, you won’t be able to reset the AllowBypass property. By same token, if you are concerned someone can use code like this to bypass your own database’s startup options, you need to implement user-level security, or at minimum set a database password.

      HTH

      • #626644

        right, this is not a secured database.

        i am assuming this was his shortcut method of security; I am searching for the transparent command button that will reenable the bypass key.

        no, there is no phone; unless anyone knows Paul Doheny. they were going to move him to a cubicle from an office; he called in with family problems; needed a week; called in after a week and needed rwo more weeks; and they never saw him again. They think he did not want to move into the cubicle.

        thanks all for the ideas.

        • #626650

          If it’s not a secured database, an expedient may be to import all the objects into a new empty database – that will fix the issue with the bypass flag.

    Viewing 2 reply threads
    Reply To: Reset AllowByPassKey property back to True (A2K/A2K2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: