Results 1 to 6 of 6
  1. #1
    newbie30 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    15

    Diabling Shift key in Access 2010 while start up

    Hi,



    I know there are a number of posts regarding this topic, however am confused since there are no proper steps to explain a novice .

    My code involves a lot of ADO and SQL. Since the examples showed DAO egs I added a reference to the DAO library.

    1. In the form load of the opening form , should I just give Currentdb.Properties("AllowByPassKey"), True?
    2. Should I create a new Autoexec macro for this?
    3. Should I write a new module to call the properties?

    Could someone kindly help as its urgent.

    Thanks Much

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    try this:

    You might have to set your "References" in the VBA editor to DAO 3.6.
    When you are viewing a Module, click the Tools menu » References. Browse for Microsoft DAO 3.6

    usage:
    SetProperties "AllowBypassKey", dbBoolean, False

    Code:
    'Copy this function into a new public module.
    
    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_SetProperties:
        Exit Function
    
    Err_SetProperties:
        If Err = 3270 Then    'Property not found
            Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
            db.Properties.Append prp
            Resume Next
        Else
            SetProperties = False
            MsgBox "SetProperties", Err.Number, Err.Description
            Resume Exit_SetProperties
        End If
    End Function

  3. #3
    newbie30 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2017
    Posts
    15
    Thanks for the reply Ranman.

    I have added this piece and from the _load event of the main form(opening form) I called that Setproperties "AllowByPassKey".

    And this works for .adp and .ade files right when I test it, however when I pass it on to the users to test, they say they can still open using the Shift key

    Do I have to do something else for others to enable this?


    Thanks in advance.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    Two points regarding the above:

    Microsoft DAO 3.6 reference is obsolete in newer versions of Access.
    It was replaced by Microsoft Office xx.x Access database engine Object Library where xx is the Access version (14.0 for Access 2010).
    This reference is loaded AUTOMATICALLY when you create new databases

    If you try to load the DAO reference, you will get a conflict error.

    Add the shift bypass code line supplied by Ranman to the Form_Load event of your startup form.
    You will need to restart Access twice for this to be implemented.
    Once to load the form & run the code & again for it to take effect

    I would recommend several other things depending on how secure you want the db to be:
    1. Provide code to prevent this when the developer (you) open the app or you will also be locked out
    Once again you will need to restart Access twice for this to be disabled again
    OR WORK ON A COPY WHERE THIS CODE IS DISABLED
    2. Add code to hide the nav pane & ribbon
    3. Untick Use Access special keys, Allow Full Menus & Display Status Bar - all in Access options
    4. Make all tables hidden ... so they can't be viewed from another db
    5. Finally convert your DB to ACCDE to hide the code (keep an ACCDB version for yourself)





    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,411
    @Ridders

    4. Make all tables hidden ... so they can't be viewed from another db
    They can be, the 'show hidden objects' property resides with the current access application, not the 'target' db. So if a user opens a new db, sets the navigation properties to show hidden objects then links to the db with hidden tables.....

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    I had forgotten that!
    Well that's just wrecked some security features in one of my databases...!

    I also add a password but even that's not enough for one of my databases.
    For some tables I also hide fields just in case ... though of course they can be unhidden

    Another extra level of security (if needed) is to require the database to be opened as an administrator

    The attached example db is an experiment I was working on a few months ago that might be of interest
    As always with these things, I didn't quite finish it ....
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 09-20-2017, 01:33 AM
  2. Replies: 3
    Last Post: 06-22-2016, 04:33 PM
  3. Replies: 4
    Last Post: 07-23-2014, 07:37 AM
  4. Make-shift Work rota in Access
    By jimmy2 in forum Database Design
    Replies: 4
    Last Post: 12-30-2012, 02:29 AM
  5. Vba Code delete&shift up cells- Access 2007
    By Luca87itc in forum Programming
    Replies: 2
    Last Post: 02-08-2012, 02:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums