Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Serbia and Montenegro (Yugoslavia)
    Thanked 0 Times in 0 Posts

    Lost property in Access 2002 version (Access 2K2)

    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
    Exit Function

    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

    '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
    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Lost property in Access 2002 version (Access 2K2)


    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

Posting Permissions

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