AllowBypass key not working to prevent users from using SHIFT key to open database
Posted on 2014-09-29
I am ready to put my Access program into production. When I do, I want only the default Access form to appear when the application launches on the network. The ShowToolbar code below works; therefore, anyone else going into the Access application will not see the navigation objects on the left or the toolbar icons/buttons/commands on the top. This is good; however as many of you know, when you hold the SHIFT key down and launch the Access database application, it "bypasses" the startup options and displays the navigation and toolbar - things I don't want the users to see and possibily accidentally access.
I Googled and found that setting AllowByPass = False would prevent the start up from displaying everything other than the form itself. Nothing so far seems to work in keeping these items "hidden" if a user were to hold the SHIFT key and launch the application. I'm using Access 2010 and ADO. The code, which is located in the Form_Open is shown below: (strUserNameLogin is already established earlier in the Form_Open event and the File --> Options --> Current Database --> Display form is set to the form I want opened when the Access application launches.
If strUserNameLogin = "jef0155" Then (My computer account login)
DoCmd.ShowToolbar "Ribbon", acToolbarNo (should be Yeswhen ready to go)
DoCmd.ShowToolbar "Status Bar", acToolbarNo (should be Yeswhen ready to go)
CurrentProject.Properties.Add "AllowBypassKey", False (should be True when ready to go)
DoCmd.ShowToolbar "Ribbon", acToolbarNo
DoCmd.ShowToolbar "Status Bar", acToolbarNo
CurrentProject.Properties.Add "AllowBypassKey", False
Am I missing something? Any help and suggestions would be greatly appreciated.