Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 17th, 2003, 12:43 AM
Authorized User
Join Date: Jun 2003
Posts: 54
Thanks: 2
Thanked 0 Times in 0 Posts

To use the shift key to bypass the startup options and autoexec, go to your .MDB file (NOT the .MDE). If you are viewing it in Windows Explorer, hold down the SHIFT key and keep holding it down as you open the .MDB file.

Be sure to read your help files on the subject. The following is from MS ACCESS XP help file:
Ignore startup options
If you used the Startup dialog box (Tools menu) or created an AutoExec macro or an Open event procedure to specify what happens when you open a Microsoft Access application, you can bypass those settings to regain full access to your Access file.

Hold down the Bypass key (the SHIFT key) while you open the database.
Note You can disable the bypass key by writing a macro or Microsoft Visual Basic for Applications code that sets the AllowBypassKey property of the database to False.

Here is some code that will allow you to disable the SHIFT key ... warning: follow the advice of everyone preceding my reply ... only execute this code in a BACKUP of the .MDB file.

This is also from the VBA Editor Help file in MS Access 2000 (could not find it in XP:

'The following SubRoutine sets the StartUp properties.
'It uses the general purpose procedure ChangeProperty to set the startup properties.
'WARNING: Make a copy of this .MDB file and open it before running this code. This will
' irreversably lock you out of the built-in menus and toolbars, once you close the .MDB file.
' Run ONLY once per copy. NEVER run it in the original .MDB file.

Function SetStartupProperties()
    'ChangeProperty "StartupForm", dbText, gcstr_Frm_Switch_Board ' The form to open on Start Up.
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    'ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, False
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, False
    ChangeProperty "AllowToolbarChanges", dbBoolean, False
    ChangeProperty "AllowShortcutMenus", dbBoolean, False
    'ChangeProperty "StartupMenuBar", dbText, "customStandardMenu"

    ' This is the ultimate that locks you out from using the "Shift" key to bypass at startup.
    ChangeProperty "AllowBypassKey", dbBoolean, False '<=== THIS DISABLES "SHIFT"!

End Function

'The general purpose procedure ChangeProperty attempts to set the startup
'property and, if the property isn't found, uses the CreateProperty method to append it to the Properties collection
'of the Database object. This is necessary because these properties don't appear in the Properties collection until
'they've been set or changed at least once.

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    Dim dbs As Database, prp As Property
    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

--- Tom

Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit Forms with Master/Multiple SubForms natwong Access 1 February 27th, 2007 01:01 PM
Forms and tables in Access 2003 marclf Access VBA 2 October 24th, 2006 07:10 AM
Hiding Tables/Forms Paula222 Access VBA 1 April 17th, 2006 02:59 PM
2 tables, 1 query, 1 form, cannot edit :( tanjuakio Access 2 June 24th, 2005 06:24 AM
SQL Injections Prevention phungleon Classic ASP Databases 1 April 8th, 2005 12:23 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.