Disable shift key

G

Guest

Hello,

I have been reading up on previous questions about disabling the shift key
through this newsgroup.

I understand that I have to set the AllowByPass property to false.

My problem is how do I get into the database if the shift key is disabled.
Is there some way of setting up another combination key that only I would
know. I need a way to get into the .db other that using the shift key if its
disabled.

I tried creating an .mde database so that I could have a database that I
could give to users and then use the .mdb to go in and modify the original
but I get the error "Microsoft Access was unable to create .mde database."
Does this mean that this is not possible for my database that I have created?

I have created a startup menu that comes up when the database is open.

Any help is appreciated..
 
J

Joan Wild

Franca said:
My problem is how do I get into the database if the shift key is
disabled. Is there some way of setting up another combination key
that only I would know. I need a way to get into the .db other that
using the shift key if its disabled.

You can set it back to true from another database. Just change the code to
refer to the other database rather than currentdb.
I tried creating an .mde database so that I could have a database
that I could give to users and then use the .mdb to go in and modify
the original but I get the error "Microsoft Access was unable to
create .mde database." Does this mean that this is not possible for
my database that I have created?

No that would be a better/easier approach. Create the mde and disable the
shiftkey and send it out. Your mdb needn't have the shiftkey disabled.
Unable to create mde could mean that you have errors in your code. Use
Ctrl-G and then Debug, Compile to see what it finds.

Another reason could be that you are using 2002 or 2003, but your database
is in 2000 format (check the database window title bar). Convert it to your
version, compile it and then try creating the mde.
 
G

Guest

Thanks. I was able to create the .mde database but now how do I set the
AllowBypasskey to false if the code is not editable? I am using the
Microsoft website on How to enforce or disable the startup options is an
Access database project. It seems like I can't save it. Is there another
way of doing it from the .mde database?

I'm new to access so if you could be as detailed as possible I would
appreciate it.

I found
 
J

Joan Wild

Franca said:
Thanks. I was able to create the .mde database but now how do I set
the AllowBypasskey to false if the code is not editable?

I guess I was suggesting that you don't. Why would you need to get into the
design of a mde? You always have to go back to your mdb to make changes
anyway.

Keep the mdb for any changes, and don't disable the shiftkey in it. When
you are ready to distribute an updated frontend, you create the mde and then
disable the shiftkey in the mde and distribute.
 
G

Guest

I have created the .mde database but what I don't understand is how to
disable the shiftkey in the .mde?

I understand that I will make changes to .mdb database and not disable the
shift key in that database otherwise I won't be able to get in.

I am following the Microsoft Instructions on how to change the
AllowByPassKey and it is not working in the .mde. It seems that it is doing
this cause I can't save any changes.
 
R

Rick Brandt

Franca said:
I have created the .mde database but what I don't understand is how to
disable the shiftkey in the .mde?

I understand that I will make changes to .mdb database and not disable the
shift key in that database otherwise I won't be able to get in.

I am following the Microsoft Instructions on how to change the
AllowByPassKey and it is not working in the .mde. It seems that it is doing
this cause I can't save any changes.

You cannot make design changes to code based objects in an MDE (forms,
reports, modules, etc.), but AllowByPassKey is a *property* and can be
changed in an MDE just as easily as in an MDB.

I do this all the time with no problems. I have startup code that disables
the ByPassKey (even though it really only needs to run once) and a password
protected routine that re-enables it in situations where I need it.
 
G

Guest

What code do you use and how do I go about doing this.

I'm new to access so could you be as descriptive as possible.

Thanks...
 
R

Rick Brandt

Franca said:
What code do you use and how do I go about doing this.

I'm new to access so could you be as descriptive as possible.

'************************************************-
Private Sub DisableByPassButton_Click()

On Error GoTo ErrHandler

Dim db As Database
Dim prp As Property

Set db = CurrentDb
db.Properties("AllowBypassKey") = False
Set db = Nothing

Egress:
On Error Resume Next
Set db = Nothing
Set prp = Nothing
Exit Sub

ErrHandler:
MsgBox Err.Number
If Err.Number = 3270 Then ' Property not found.
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, False)
db.Properties.Append prp
Resume Next
Else
MsgBox Err.Description
Resume Egress
End If
End Sub

'***********************************************
Private Sub EnableByPassButton_Click()

On Error GoTo ErrHandler

Dim db As Database
Dim prp As Property

Set db = CurrentDb
db.Properties("AllowBypassKey") = True
Set db = Nothing

Egress:
On Error Resume Next
Set db = Nothing
Set prp = Nothing
Exit Sub

ErrHandler:
MsgBox Err.Number
If Err.Number = 3270 Then ' Property not found.
Set prp = db.CreateProperty("AllowBypassKey", dbBoolean, True)
db.Properties.Append prp
Resume Next
Else
MsgBox Err.Description
Resume Egress
End If
End Sub
'*************************************************
 
G

Guest

I don't understand where this code goes? I know I have to do this in the
..mde database but how do you add code when you aren't allowed to modify or
add code? Do you open the MS visual editor and add it there?

Confused..
 
R

Rick Brandt

Franca said:
I don't understand where this code goes? I know I have to do this in the
.mde database but how do you add code when you aren't allowed to modify or
add code? Do you open the MS visual editor and add it there?

You don't. You either add it to your MDB and then create a NEW MDE from that or
you modify the code so that instead of working against CurrentDB you use it
against an external file. That method would allow you to use one MDB to toggle
the property in another file altogether. When run against an external file it
would not matter if it were an MDE or an MDB.
 

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