Disable shift key in MS Access 2003

Posted on 2007-10-01
Last Modified: 2013-11-27
Hi experts,

I am trying to disable the shift key in my MS Access 2003 application so that users cannot bypass the runtime MDE properties and access the design view where they have a full version of MS Access.  I have found the following code in the Microsoft knowledgebase but cannot make it work in my application.  Do I need to modifications to this code to make it work?

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

    Exit Function

    If Err = conPropNotFoundError Then    ' Property not found.
        Set prp = dbs.CreateProperty(strPropName, _
            varPropType, varPropValue)
        dbs.Properties.Append prp
        Resume Next
        ' Unknown error.
        ChangeProperty = False
        Resume Change_Bye
    End If
End Function

Any help would be appreciated.

Question by:TerenceHewett
    LVL 13

    Expert Comment

    LVL 13

    Accepted Solution

    But along with what you have I use something like this

    Public Function SetProperties(strPropName As String, _
    varPropType As Variant, varPropValue As Variant) As Integer

        On Error GoTo Err_SetProperties

        Dim db As DAO.Database, prp As DAO.Property

        Set db = CurrentDb
        db.Properties(strPropName) = varPropValue
        SetProperties = True
        Set db = Nothing

        Exit Function

        If Err = 3270 Then    'Property not found
            Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
            db.Properties.Append prp
            Resume Next
            SetProperties = False
            MsgBox "SetProperties", Err.Number, Err.Description
            Resume Exit_SetProperties
        End If
    End Function

    Author Comment

    Thanks Wis for your help.  Regards,

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now