Shift Key function

K

Karren Lorr

I have disabled the shift key (using the AllowBypassKey = False) so that
users can't get into a database sections they are not meant to. I would like
to enable this function on a stand alone application - most of the methods I
have seen rely on the application being held on a server and they all seem to
fail when a database is zipped and e mailed ?

But

I would like to allow "some" staff members but not other to use the shift
key so they can look at the application in design view.

Thank you


Karen Lorr
 
D

Douglas J. Steele

I don't understand what you mean that "most of the methods I have seen rely
on the application being held on a server". All you need to do is change the
value of the AllowBypassKey property from False to True.


Sorry, but it's an all-or-nothing proposition.
 
K

Karren Lorr

THank you

But how do I change the False to True if I can't get into the database
design ?.

Sorry to ask such simple (I hope) questions

At the moment I have a master copy without the shift key disabled and
another copy with it set to false (disabled). I was thinking there should be
a better way of doing this

?
 
J

John Spencer

I usually put in a "back door" of some type to reset the AllowByPass key
property to True.

I also have code that runs to set the AllowByPassKey property to false that
runs in a start up routine.

One method is to use an event on an unattached label's click event in an
obscure location (such as an about this database form) that when
double-clicked runs the code to set the AllowByPassKey to true.

Then the user closes the database and reopens with the shift-key depressed.

You can make the reset harder by using a variety of techniques
-- Require a password to be entered
-- Check to see if the shift key or the control key is depressed when the
label is clicked
-- Check to see who the user is
-- or a combination of the above.

Another option is to check out ALbert Kallal's site. I think he has code
there that can be run externally to the database to reset AllowShiftBypassKey
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
A

Arvin Meyer [MVP]

You can try using Ctrl+G to open a code window to run your code. If that
doesn't work, go to the Access Web:

http://www.mvps.org/access/general/gen0040.htm

and download the code. Open another database and paste it in, then change
the line:

Set dbs = CurrentDb

to the path to your database, like:

Set dbs = "C:\Myfolder\MyDB.mdb"

and change it there.
 
W

Wayne-I-M

Hi

Using the AllowBypassKey = False simply will not work to secure a database.

It may work to stop people pressing the shift key by mistake when they open
the DB and seeing “stuff†they don’t understand. But it will NOT stop anyone
from getting the entire DB, if they want to ?

Almost everyone one this forum will know how to get round the remove of the
Shift Key Startup option (2 weeks ago I got into my sister's database as she
did just done what you did and couldn't get into her own application?) , so
don’t use this as any form of security. But, up to you ;-)

If you realise this and just want to stop people pressing the shift key to
see the design by mistake (I would also use the start up options to assist
with this) then you should just disallow the shift key and then put a
password on the switchboard to allow it, if needed. You could then give the
users you want to see the design the password.

******************
To follow on from John Spencer's idea of a back-door (or in this case a
simple button) have a look at this - try it on a practice DB and if you're
happy with it (I would change all the mesages for a start :) put it on a
copy of your main DB - make a back up 1st ???

Note
This will disable to shift key and allow you (or anyone else with the
password) to reset it) but it will NOT (in anyway) secure the database.

For this I have used
"INSERT PASSWORD HERE"
as the password - without the commas, I would change it if I were you


Create a button (called KarensButton) on your switchboard. Put this OnClick

Private Sub KarensButton_Click()
On Error GoTo Err_KarensButton_Click
Dim strSomeThing As String
Dim strMsg As String
Beep
strMsg = "You can enable the Shift Key by putting in the password into the
box" _
& vbCrLf & vbLf & "Warning" & vbCrLf & vbLf & _
"If you change the codes and design functions in this database" _
& vbLf & "it may become unworkable and you could lose all the data" _
& vbLf & vbLf & "If you don't have the password, please contact me."
strSomeThing = InputBox(Prompt:=strMsg, Title:="Message from Karen")
If strInput = "INSERT PASSWORD HERE" Then
'Karen - Change the above to what you want BUT DON'T FORGET IT :)
SetProperties "AllowBypassKey", dbBoolean, True
Beep
MsgBox "Next time you open the Database, hold down the Shift key.", _
vbInformation, "Message from Karen - Correct password"
Else
Beep
SetProperties "AllowBypassKey", dbBoolean, False
MsgBox "Incorrect Password!" & vbCrLf & vbLf & _
"You can't use this shift key.", _
vbCritical, "Message from Karen"
Exit Sub
End If
Exit_KarensButton_Click:
Exit Sub
Err_KarensButton_Click:
MsgBox "Runtime Error # " & Err.Number
Resume Exit_KarensButton_Click
End Sub


Give it a try and let us know if you have problems - am sure someone will be
able to help

Good luck
 
K

Karren Lorr

Thank your help.

Can you tell me what does dbBoolean mean and is this part of the message
that a user will see ? (as it does not show up).
Will it run a code or something else ?

Karen
 
W

Wayne-I-M

Sorry but I have just read through my answer and I forget to add the second
bit of code (that will make it work)

Sorry about that
Create a new (public) module and paste this in



Public Function SetProperties(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
On Error GoTo Err_SetProperties
Dim db As DAO.Database, prp As DAO.Property
Set db = CurrentDb
db.Properties(strPropName) = varPropValue
SetProperties = True
Set db = Nothing
Exit_SetProperties:
Exit Function
Err_SetProperties:
If Err = 3270 Then
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Else
SetProperties = False
MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description
Resume Exit_SetProperties
End If
End Function
 
D

Douglas J. Steele

dbBoolean is an intrinsic constant (meaning it's define by Access). In that
particular case, it indicates to Access to create a Boolean property (as
opposed to a Numeric or Text one)

(Of course, it'll only work if you add the SetProperties Wayne gave you
later on!)
 

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

Similar Threads


Top