• Lost property in Access 2002 version (Access 2K2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Lost property in Access 2002 version (Access 2K2)

    Author
    Topic
    #383912

    I created a database using Access 2002 in an Access 2000 format. The front end is Visual Basic 6. I don’t want the users to have direct access to the back end, but since security is managed by Access, if they knew what they were doing they could crack into the back end with their user level. There is a little function I found that will disable the shift key on launch, and I can set the start up options to not display any of the interface, which seems to have worked for me in the past. Now that property of the database object isn’t available that I can find. I looped through the different properties and printed them:

    0 Name
    1 Connect
    2 Transactions
    3 Updatable
    4 CollatingOrder
    5 QueryTimeout
    6 Version
    7 RecordsAffected
    8 ReplicaID
    9 DesignMasterID
    10 Connection
    11 AccessVersion
    12 Build
    13 ProjVer

    The code I’m using errors on that property db.Properties(“AllowByPassKey”) doesn’t exist.

    Function ap_DisableShift()
    ‘This function will disable the shift at startup causing
    ‘the Autoexec macro and Startup properties to always be executed

    MsgBox CurrentUser

    If CurrentUser = “MyUserName” And GroupMembership(CurrentUser) = “Access” Then
    ap_EnableShift
    Exit Function
    Else

    On Error GoTo errDisableShift

    Dim db As Database
    Dim prop As Property
    Const conPropNotFound = 3270

    Set db = CurrentDb()

    ‘This next line disables the shift key on startup.
    db.Properties(“AllowByPassKey”) = False

    ‘function successful
    Exit Function
    End If

    errDisableShift:
    ‘The first part of this error routine creates the “AllowByPassKey
    ‘property if it does not exist.
    If Err = conPropNotFound Then
    Set prop = db.CreateProperty(“AllowByPassKey”, _
    dbBoolean, False)
    db.Properties.Append prop
    Resume Next
    Else
    MsgBox “Function ‘ap_DisableShift’ did not complete successfully.”
    Exit Function
    End If

    End Function

    I’m interested in not only if I can get this to work again, but if this is an appropriate security measure.

    Viewing 0 reply threads
    Author
    Replies
    • #656513

      Mike,

      I copied your code to a test database in Access 2002 format. I had to take out the GroupMembership bit because it isn’t known, but after that the code ran without a problem, and with the desired result.

      The first time it is run, the AllowByPassKey property is unknown. The On Error handler then creates the property with a default value of False.

      Database and Property are DAO objects. Do you have a reference to the Microsoft DAO 3.6 Object Library?
      To be on the safe side, I always prefix DAO objects:

      Dim db As DAO.Database
      Dim prop As DAO.Property

    Viewing 0 reply threads
    Reply To: Lost property in Access 2002 version (Access 2K2)

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

    Your information: