Here's the situation. My Access 2002 app has a form that
allows me to switch the AllowBypassKey property on and
off. This form is accessed from a toolbar. When I log
in, the app knows it's me and shows the tool that opens
this form. So I can never accidentally get locked out.
Or so I thought!!!
First, I mistakenly locked the MDB instead of the MDE
only. Second, for some unknown and bizare reason, the app
is throwing an error at startup and the tool I need is
failing to load correctly, thus preventing me from
accessing the unlock bypass function. What's more, this
error is handled, so it does not offer to open the code
project. Also, AllowSpecialKeys and ShowDatabaseWindow
are turned off too.
So, it appears I'm permanently locked out of my
development build, and I have lost today's work.
Is there of any hack that can get me into my MDB file. I
did a lot stuff today. Ouch!!!
Tim
'************Untested air code
Dim dbTarget as DAO.Database
Set dbTarget = DBEngine.OpenDatabase("Path to your Database.mdb")
dbTarget.Properties("AllowBypassKey") = True
dbTarget.Properties("AllowSpecialKeys") = True
Set dbTarget = Nothing
'*************
Of course, if the target database does not have property you are trying to
change, you will raise error 3270, property not found. In this case, you'll
have to use something like
'more air code
dbTarget.Properties.Append db Target.CreateProperty("PropertyName",
dbBoolean, True)
I hope this helps!
Kevin
"Tim" <tsco...@SSPPAAMMbidtoprint.com> wrote in message
news:065a01c308fb$f9d47610$2f01...@phx.gbl...
1. Create a new MDB
2. Import all objects from the locked MDB
3. Reset all the references
4. Create any properties that needed to be created
Looks like it's going to work.
I discovered that somehow my tool got corrupted. It was a
menu item with some items. All the items were gone, and
it would not allow me to add any. I had to delete it and
create a new one.
Tim
>.
>
Create a new Access 2002 application.
Set the OpenDatabase() to the database you need to remove the
"AllowBypassKey".
Set the property "AllowBypasskey" to True.
The code fragment below is an Access 97 version. It should be
straight-forward enough for you to translate it to Access 2002. If you still
have trouble, let me know.
Public Function Main(pfSetting As Boolean) As Boolean
Dim dbs As DAO.Database
Dim strDir As String
Dim fRetVal As Boolean
Dim prp As Property
On Error GoTo Proc_Err
' ***
' Hard code in the path and filename of the Access database
strDir = "???"
Set dbs = OpenDatabase(strDir)
dbs.Properties("AllowBypassKey") = pfSetting
dbs.Close
Set dbs = Nothing
fRetVal = True
Proc_Exit:
Main = fRetVal
If fRetVal Then
MsgBox "AllowBypassKey property has been set to [" & pfSetting & "]."
Else
MsgBox "The AllowBypassKey property was not set!"
End If
Exit Function
Proc_Err:
If Err = 3270 Then
Set prp = dbs.CreateProperty("AllowByPassKey", dbBoolean, False)
dbs.Properties.Append prp
Resume Next
Else
MsgBox Err.Description
fRetVal = False
End If
Resume Proc_Exit
End Function
--
Rob
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-Having trouble with your database?
-Are you ready to upgrade, but don't have the expertise?
Let the FMS Professional Solutions Group solve it for you.
www.FMSInc.com/Consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Tim" <tsco...@SSPPAAMMbidtoprint.com> wrote in message
news:065a01c308fb$f9d47610$2f01...@phx.gbl...
>.
>