Locked out of my Database by disabling Startup Properties

Z

ZEKE

I set startup properties based on permissions when the db opens and lock them
down again on close. I always leave the ByPassKey property set to true so I
can get back in by holding down the shift key. However, I got copy/paste
happy and set it also to False and now am locked out of my db. (Code Below)
I also have the VBA Editor password protected so I can not import the forms
and modules into blank db. Any suggestions to get back in?

db.Properties("StartUpShowDBWindow") = False
db.Properties("StartUpShowStatusBar") = False
db.Properties("AllowSpecialKeys") = False
db.Properties("AllowBuiltInToolbars") = False
db.Properties("AllowFullMenus") = False
db.Properties("AllowShortcutMenus") = False
db.Properties("AllowToolbarChanges") = False
db.Properties("AllowByPassKey") = False
 
G

George Nicholson

Open another database, even an empty blank one, and create a short routine
that sets a reference to your locked db, then reset the AllowBypassKey
property.

Here is some aircode. You'll have to fiddle with the 2nd line to make it
work in your situation.

Dim db = dao.Database
Set db = opendatabase("Path/path/myLockedFile.mdb")
db.Properties("AllowByPassKey") = True
Set db = nothing
 
J

John Spencer

You can get use something like the following if you know the full path
to your database.

Try copying the following function into a module in ANOTHER database and
calling the function. You will need to set the strPath to the path of
your database

Public Function ResetExternalDatabaseBypassKey _
(Optional tfAllow As Boolean = True)
'*******************************************
'Name: ResetExternalDatabaseBypassKey (Function)
'Purpose: Sets AllowByPassKey to true in another Access Database
'Author: John Spencer UMBC-CHPDM
'Date: May 02, 2000, 12:08:19 PM
'*******************************************
Dim dbs As Database
Dim strPath As String

On Error GoTo ResetExternalDatabaseBypassKey_ERROR

strPath = "C:/MyDatabases/SomeDataBaseName.mdb"

Set dbs = DBEngine.Workspaces(0).OpenDatabase(strPath)
dbs.Properties("AllowByPassKey") = tfAllow


ResetExternalDatabaseBypassKey_ERROR:
Select Case Err.Number
Case 3270 'Property not found
MsgBox "Allow Bypass Key property does not exist " & _
"for the chosen database."
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select

End Function

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Z

ZEKE

Thanks.

George Nicholson said:
Open another database, even an empty blank one, and create a short routine
that sets a reference to your locked db, then reset the AllowBypassKey
property.

Here is some aircode. You'll have to fiddle with the 2nd line to make it
work in your situation.

Dim db = dao.Database
Set db = opendatabase("Path/path/myLockedFile.mdb")
db.Properties("AllowByPassKey") = True
Set db = nothing
 
Z

ZEKE

Thanks.

John Spencer said:
You can get use something like the following if you know the full path
to your database.

Try copying the following function into a module in ANOTHER database and
calling the function. You will need to set the strPath to the path of
your database

Public Function ResetExternalDatabaseBypassKey _
(Optional tfAllow As Boolean = True)
'*******************************************
'Name: ResetExternalDatabaseBypassKey (Function)
'Purpose: Sets AllowByPassKey to true in another Access Database
'Author: John Spencer UMBC-CHPDM
'Date: May 02, 2000, 12:08:19 PM
'*******************************************
Dim dbs As Database
Dim strPath As String

On Error GoTo ResetExternalDatabaseBypassKey_ERROR

strPath = "C:/MyDatabases/SomeDataBaseName.mdb"

Set dbs = DBEngine.Workspaces(0).OpenDatabase(strPath)
dbs.Properties("AllowByPassKey") = tfAllow


ResetExternalDatabaseBypassKey_ERROR:
Select Case Err.Number
Case 3270 'Property not found
MsgBox "Allow Bypass Key property does not exist " & _
"for the chosen database."
Case Else
MsgBox Err.Number & ": " & Err.Description
End Select

End Function

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top