Holding down Shift (1 Viewer)

af1112

New member
Local time
Today, 23:50
Joined
Feb 13, 2005
Messages
1
Need more help

Hi,

this faq is nice but i'm not so expert to do this I need more help

I understand that I have to create one new module and paste this code there and save it
and in my main form I have to create one botton and in onclick event I have to say to run this module
I don't know how I should write the command on event to say run the modules??

your help will be appreciated
Ali Fekri
 

Groundrush

Registered User.
Local time
Today, 20:20
Joined
Apr 14, 2002
Messages
1,376
Hello af1112 welcome to the Forum... :)

I use this code that ghudson supplied at the beginning of this post.

First of all create a copy of your db (Just incase.. :rolleyes: )

Now......

Create a label on a form somewhere and make it invisible to other users
(I have mine hidden in my main Switchboard)

The idea is that by clicking on the label you can activate/de activate the code without anyone else knowing about what you are doing.. ;)

Name the label "bDisableBypassKey" & hide it somewhere in the corner of your screen or something.

Copy & Paste the code inbetween the bold text to the onclick event of the label you have just created


Private Sub bDisableBypassKey_Click()

On Error GoTo
Err_bDisableBypassKey_Click
'This ensures the user is the programmer needing to disable the Bypass Key
Dim strInput As String
Dim strMsg As String
Beep
strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the programmer's password to enable the Bypass Key."
strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")
If strInput = "MY PASSWORD" Then 'Change password to your own
ChangeProperty "AllowBypassKey", DB_BOOLEAN, True

Beep
MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup options the next time the database is opened.", vbInformation, "Set Startup Properties"
Else
Beep
ChangeProperty "AllowBypassKey", DB_BOOLEAN, False

MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid Password"
Exit Sub
End If
Exit_bDisableBypassKey_Click:
Exit Sub
Err_bDisableBypassKey_Click:
MsgBox "bDisableBypassKey_Click", Err.Number, Err.Description
Resume Exit_bDisableBypassKey_Click

End Sub

Now paste this code in the Double click event of the same label

Private Sub bDisableBypassKey_DblClick(Cancel As Integer)
Private Sub Disable_Click()
Option Compare Database

Option Explicit

Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If

End Function

To Test
click on your label to activate the password prompt
and type in the wrong password (that will now disable the bypass key) and you will not be able to open the db by holding down the Shift button

to disable enter the correct password and you will be able to use the Shift button

Hope this helps..... :)
 
Last edited:

kybb1

Registered User.
Local time
Today, 20:20
Joined
Dec 17, 2002
Messages
29
af1112 said:
Hi,

this faq is nice but i'm not so expert to do this I need more help

I understand that I have to create one new module and paste this code there and save it
and in my main form I have to create one botton and in onclick event I have to say to run this module
I don't know how I should write the command on event to say run the modules??

your help will be appreciated
Ali Fekri

If you download the sample on my post, all you have to do is:

In your db, go to tables, select IMPORT tables, find the sample db that you SHOULD have downloaded, select the modules and the macro.

Once those are in there security is taken care of. From here, if you want to Bypass the Shift key, hit Ctrl+Shift+S, if you want to Allow the Shift key, hit Ctrl+Shift+G.

All you have to do....no special buttons, forms, hidden anything....very easily done.

If you need any further help, just post back....just remember to download the sample first.

Hope this is what you're looking for.
 

JordanR

Registered User.
Local time
Today, 12:20
Joined
Jan 25, 2005
Messages
72
I'm finding one issue with the code, and I'm not sure if I'm doing something wrong here.
1. Click my transparent button I get prompted for the password.
2. I type it in, then close the database.
3. Open the database and the shift key works.
4. Close the database.
5. Reopen the database and the shift key still works.
6. Click the hidden button and get prompted for the password.
7. Enter a wrong password and get the expected error message.
8. Close the database.
9. Reopen the database and the shift key doesn't work.

So I'm finding that you have to enter a wrong password to turn off the Shift key bypass. Is that supposed to be how it works?
 

Groundrush

Registered User.
Local time
Today, 20:20
Joined
Apr 14, 2002
Messages
1,376
JordanR said:
I'm finding one issue with the code, and I'm not sure if I'm doing something wrong here.
1. Click my transparent button I get prompted for the password.
2. I type it in, then close the database.
3. Open the database and the shift key works.
4. Close the database.
5. Reopen the database and the shift key still works.
6. Click the hidden button and get prompted for the password.
7. Enter a wrong password and get the expected error message.
8. Close the database.
9. Reopen the database and the shift key doesn't work.

So I'm finding that you have to enter a wrong password to turn off the Shift key bypass. Is that supposed to be how it works?

Correct... :)

By entering the correct password it will allow access to your tables.qry's...etc
by entering the incorrect password it will disable the bypass key and prevent access to your db.
 
Last edited:

JordanR

Registered User.
Local time
Today, 12:20
Joined
Jan 25, 2005
Messages
72
Yea, but my point is that you actively have to enter an incorrect password to disable the feature once it's enabled. Is that by design?
 

Groundrush

Registered User.
Local time
Today, 20:20
Joined
Apr 14, 2002
Messages
1,376
JordanR said:
Yea, but my point is that you actively have to enter an incorrect password to disable the feature once it's enabled. Is that by design?

Yes it is.

I guess it's purpose would be that if a user was able to find your hidden button they would have to know your password to enable it.
If they guess incorrectly it will prevent users access to it.
 

roystreet

Registered User.
Local time
Today, 11:20
Joined
Aug 16, 2004
Messages
47
Another Version - I like better

Hi Guy's,
....I had ran into this problem at one time because I had very confidential data secured in an Access DB. The 'general user' wouldn't probably know to try to press shift-enter, but I still wasn't happy with that. I have a code that, once you log in as an admin you can select from a bullet list; either to Allow Shift-Enter Bypass or Disable it. This way, you only need to know one pass/user - The regular one. This code also can be used as a basis to make it so that only specific groups see certain things. For example, I have a splash screen that opens up if you are a part of a specific group. If you are a member of the admins, it skips that splash screen and goes directly to what I call the Admin Director. It's all based upon the group that the user is assigned to. You can even make it so that only specific fields will show up in a form based upon your group membership. If you are interested I will post it here.
...Another thing I use this as a basis for is I have it set up so depending upon the group you are a member of, the 'X' at the top right is or isn't visible at all. Of course, it's visible if you are an admin, but if not - It goes away!! ;)
....There are no hidden buttons with this code and there is No-Way a user from another group can access the Admin Director form which is where you can controll the shift-enter disable.

Have A Good Day,
---roystreet :)

(Of course nothing that has to do with computers is totally unbreakable - But this is pretty hard!! - I don't even see how you can! :D )
 
Last edited:

connordrew

Registered User.
Local time
Today, 20:20
Joined
Aug 14, 2003
Messages
22
i'd like to see acopy of that Roy. Could u post it m8?

Cheers
 

roystreet

Registered User.
Local time
Today, 11:20
Joined
Aug 16, 2004
Messages
47
Here Ya Go...

I'll have to cut down the size of a dbase and then attach it to here tommorrow - Right now the current one that has the forms and the modules you'll need equals about 2.9mb and that's too big for this site. The below is a brief that could help you get started with it ;)
-----------------------------------------------------------------------------------------------------
This isn't as complex as it may look - There is actually very little modification that a designer really needs to do with this. Then you basically update some of the If statements which I love to use.

Create a module named: bas_DisableShiftKeyBypass
Insert this code in it:
Code:
Option Compare Database
Option Explicit

Function fDisableShiftKeyBypass(fAllow As Boolean) As Boolean

On Error GoTo Error_fDisableShiftKeyBypass_

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim dbProp As DAO.Property

Const dbPropNotFound = 3270
           
    Set ws = DBEngine.Workspaces(0)
    Set db = CurrentDb
               
    db.Properties("AllowByPassKey") = fAllow
    fDisableShiftKeyBypass = fAllow
    
    If fAllow = True Then
    MsgBox "ATTENTION: " & CurrentUser() & " - Users now can press Shift-Enter and bypass 


portions of security and can now see the database window.  This should only be used temporarily 

for Admin purposes and should be locked soon.", vbOKOnly + vbExclamation, "By-Pass Security Has 

Been Enabled"
        'MsgBox "Shift Key Bypass property has been succesfully enabled ...", vbOKOnly + 

vbInformation, "Property Enabled"
    Else
    MsgBox "ATTENTION: " & CurrentUser() & " - Users now can NO LONGER press Shift-Enter and 

bypass portions of security.  They no longer can view the database window.  This should be the 

general use setting", vbOKOnly + vbInformation, "By-Pass Security Has Been Disabled"
        'MsgBox "Shift Key Bypass has been successfully disabled ...", vbOKOnly + vbInformation, 

"Property Disabled"
    End If
    
    
Exit_fDisableShiftKeyBypass_:

    Set ws = Nothing
    Set db = Nothing
    
    Exit Function
        
Error_fDisableShiftKeyBypass_:
      
      If Err = 3270 Then    ' property not found
        Set dbProp = db.CreateProperty("AllowByPassKey", dbBoolean, False, True)
        db.Properties.Append dbProp
        Resume Next
      Else
        Resume Exit_fDisableShiftKeyBypass_:
      End If

End Function

Now, the log on form name it: Log On
This form is the one you will have run at start up. This doesn't need to be pretty because the user will not see it at all. This form basically closes as soon as it opens. Here is the code:
Code:
Function UserGroupCheck(UserName, GroupName) As Boolean
   Dim ws As Workspace
   Dim usr As user
   Dim i As Integer

   UserGroupCheck = False
   Set ws = DBEngine.Workspaces(0)
   Set usr = ws.Users(UserName)
   For i = 0 To usr.Groups.Count - 1
           If usr.Groups(i).Name = GroupName Then
             UserGroupCheck = True
        End If
   Next i
   ws.Close
End Function

Private Sub Form_Open(Cancel As Integer)

DoCmd.Close acForm, "Log On"
If UserGroupCheck(CurrentUser(), "Admins") Then
   DoCmd.OpenForm "frm_AdminDirector", acNormal, "", "", , acNormal
'DO NOT APPLY THE SECURITY ENTRY FOR LR USERS FOR THIS BETA VERSION
ElseIf UserGroupCheck(CurrentUser(), "LR User") Then
   DoCmd.OpenForm "frm_Sunrise_Welcome", acNormal, "", "", , acNormal
ElseIf UserGroupCheck(CurrentUser(), "LOB Users") Then
   DoCmd.OpenForm "frm_Sunrise_LOB_Welcome", acNormal, "", "", , acNormal

Else
    MsgBox CurrentUser() & "   -You Do Not Have Access To Log On To This DBase - If you believe this to be in error, please contact the DBase Administrator Special Note: This could be because this is a BETA version only open to the Administrator/Designer.  (Error: 003)", vbExclamation, "DBase Logon Error:"
   DoCmd.Quit
   
   
   
   
End If
End Sub

Now, create a form name frmsettings_ insert two bullets on it and then add this code:
Code:
Private Sub ogpSecurityBypass_1_AfterUpdate()
Dim fEnableBypass As Boolean
    If Me.ogpSecurityBypass_1.Value = 1 Then
        fEnableBypass = True
    Else
        fEnableBypass = False
    End If

    fDisableShiftKeyBypass fEnableBypass
End Sub

The above form is the one that enables or disables shift enter bypass.
In the Admin Director form I have, I have just made the above form a sub form in that form. If you look in the module coding, it has a message box that will open according to which one of these you select. What happens is when you log on as an Admin, it will open your Admin Director form which I haven't placed here. Even if you or the user tries to use shift-enter it will still log them on normally as if they never used shift-enter. You change the setting in that form, the next time you log on it will enable the combination.

Hope this helps, I can include a real quick DB that has those forms and modules if you would like.
Did I confuse you enough already? :confused:
Thanks,
---roystreet
 
Last edited:

ghudson

Registered User.
Local time
Today, 15:20
Joined
Jun 8, 2002
Messages
6,195
There are no hidden buttons with this code and there is No-Way a user from another group can access the Admin Director form which is where you can controll the shift-enter disable.
Nobody will be able to open or link to your "secured" If your db is properly secured with user workgroups and user permissions. Your db should be setup so that it will not open if the user does not use a secured shortcut that has the target set to open the db with the correct version of Access, the workgroup file assigned to that db and the users login ID. The above threads related to disabling the Shift key beneft those that have yet to take the plunge and learn how to properly secure their database files using Access workgroups and user permissions. The Admin and Admins user group and permissions is the Access "default" to allow full access to a db. All Access db's are secured! They are set by default to allow the Admin user {CurrentUser()} full access with full permissions to the db. Nobody should be able to open your "secured" db by just double left clicking the .mdb file from Windows Explorer. If so, then it is not properly secured.
 

roystreet

Registered User.
Local time
Today, 11:20
Joined
Aug 16, 2004
Messages
47
You are correct that if you use workgroups that your database is essentially very secure. I have to use workgroups because of the confidentiality of the data that is stored in the dbases I work with. I will give a very basic scenario in which you can still essentially by-pass security as long as you have basic access into the database. I did not know we were discussing a database that didn't use workgroups. I will agree - They must use workgroups if they want any realistic security.
For example: you have a database that deals with court cases which contain privacy information. You have a 'limited' user that is allowed to only view the fields which provide, case number, judge, and names involved via a form designed for them. The method in which the limited user above retrieves that data is via query that filters out the data they don't have rights to view. (There are also users that have an elevated access which allows them to view all of the other fields which go into detail for each case - In which I'm not going into here) If the limited user logs in as using their current pass/user, but use shift-enter - they now can view the whole table essentially by-passing security because they are viewing more data than was intended for them. As long as they have view rights for that table which they have to have using that key comdination.
So, Yes in this case they are able to go beyond their intended use of the system. I believe you can avoid this by compliling the database. So the plunge has already been taken here - Unfortunately Access is quite far from being a super secured database, this is one of the reasons why Access is used as a front-end database and SQL Server is used as a backbone. SQL being more secure than Access is, but access is more user friendly you could say.
Thanks,
---roystreet
 
Last edited:

dapiaoen

Registered User.
Local time
Today, 20:20
Joined
Apr 6, 2003
Messages
36
Shift Key disabled

:eek: I entered the code provided by GHudson (June 2002) and it worked nicely....except...I noticed that if I kept the shift key held after it was disabled, the Tools Menu was active, and I could open Start Up and change everything.

At least that is what I think I saw. Has anyone else? :confused:

Chris
 

Groundrush

Registered User.
Local time
Today, 20:20
Joined
Apr 14, 2002
Messages
1,376
dapiaoen said:
:eek: I entered the code provided by GHudson (June 2002) and it worked nicely....except...I noticed that if I kept the shift key held after it was disabled, the Tools Menu was active, and I could open Start Up and change everything.

At least that is what I think I saw. Has anyone else? :confused:

Chris

Have you unchecked all the tick boxes in the Tools--Startup screen?

Allow full menus
Allow Default Shortcut Menus
Display Database Window
Display Status BAr
Allow Built- In Toolbars
Allow Toolbar/Menu Changes
(Advanced) Use Access Special Keys
 

dapiaoen

Registered User.
Local time
Today, 20:20
Joined
Apr 6, 2003
Messages
36
Shift Key hold

Indeed, all of the tick boxes had been checked off.

- I could get to the Startup menu and change everything, but then had to restart to see it. :eek:

Chris
 

ghudson

Registered User.
Local time
Today, 15:20
Joined
Jun 8, 2002
Messages
6,195
All "Startup" changes take effect the next time the db is opened.
 

dapiaoen

Registered User.
Local time
Today, 20:20
Joined
Apr 6, 2003
Messages
36
Shift Key Hold

GHudson,

At work, where I'm fairly sure I did restart more than once to be sure the shift bypass was disabled, I'm using Access 2000 on Windows 2000.

However, I just shifted in at home on XP with Access 2003 and the tools menu did not stay active. :eek:

I'll retest at work.
 

a2ari

Registered User.
Local time
Today, 15:20
Joined
Jun 20, 2005
Messages
28
getting around disabling 'allow bypass' false

In Access 97...

I set AllowBypass to False
I uncheck Display Database Window
I quit Access.

I select the database and open it while holding shift.
The Database Window does not appear (yay).
Without closing Access, I select File and reopen this same database again while holding shift.
The Database Window appears...

HUH?

Thoughts?
 

GarageFlower

Registered User.
Local time
Today, 20:20
Joined
May 20, 2004
Messages
108
dapiaoen said:
Indeed, all of the tick boxes had been checked off.

- I could get to the Startup menu and change everything, but then had to restart to see it. :eek:

Chris

I have found the exact same problem

The database is locked

User opens it
Holds down shift
The toolbar appears
he chooses startup optins
ticks all the boxes
re-opens the database and hes straight into the backend

hmpht
 

Users who are viewing this thread

Top Bottom