Você está na página 1de 3

Bypass Shiftkey Password - SharePoint Hill

Search this site

Home Contact Us Tutorials SharePoint Access Excel Google SQL Server Dynamics CRM GoToMeeting

Tutorials > Access >

Bypass Shiftkey Password


The concept is that a form that has the ability to disable the Shift Key design view mode is password protected. This way only the designated users with the password can access the design view mode using the Shift Key. Create a form that can be used as a starting point that all other forms (as needed) can be accessed from.

Certifications

Change the database settings so the form noted in step 1 is the startup form that is opened automatically when the database is opened.

Don't forget to remove the Tools/Menus/Navigation Options that you don't want the user to have (i.e. uncheck Display Navigation Pane & uncheck Allow Full Menus.

Template tips
Learn more about working with templates. How to change this sidebar.

Currently, you need to press the Shift Key while opening the database to access the design view mode. Create a module called ByPassShiftKey with the following code:
Option Explicit Option Compare Database Public Function SetProperties(strPropName As String , varPropType As Variant, varPropValue As Variant) As Integer

https://sites.google.com/site/sharepointhill/tutorials/msaccess/bypass-shiftkey-password[01/06/2013 01:30:42 AM]

On Error GoTo Err_SetProperties Dim db As DAO.Database, prp As DAO.Property 'Dim db As adodb.Database 'Dim db As Database, 'Dim prp As adodb.Property Set db = CurrentDb db.Properties(strPropName) = varPropValue SetProperties = True Set db = Nothing Exit_SetProperties: Exit Function Err_SetProperties: If Err = 3270 Then 'Property not found Set prp = db.CreateProperty(strPropName, varPropType, varPropValue) db.Properties.Append prp Resume Next Else SetProperties = False MsgBox "SetProperties", Err.Number, Err.Description Resume Exit_SetProperties End If End Function

Create a form that can be used Disable/Enable Shift Key Design View Entry.

Create a button on the new form (frm_menu_DBA) with the On Click event as follows:
Option Explicit Option Compare Database Private Sub cmd_Open_input_ByPassShiftKey_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") Dim QI As Integer QI = MsgBox("Do you want to disable the shift key?", vbYesNo) If QI = 7 Then 'If strInput = "pk" Then SetProperties "AllowBypassKey", dbBoolean, 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 SetProperties "AllowBypassKey", dbBoolean, False 'MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & _' MsgBox "Bypass Key Disabled!" & 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

Create a button or image on the main startup form (frm_menu_Startup) with the following code for the On Click event:
Option Explicit Option Compare Database Private Sub Auto_Logo0_Click() Dim sPwd As String , strMsg As String strMsg = "Please Enter Your Password" sPwd = InputBox(Prompt:=strMsg, _ Title:="Form Security Check", XPos:=5000, YPos:=4000) Select Case sPwd Case "my!password" 'This is the password DoCmd.OpenForm "frm_menu_DBA", acNormal, , , acFormReadOnly Case Else MsgBox "Sorry, Wrong Password Entered. Please Try Again" End Select End Sub

Go ahead & close the database, then re-open. You should see the main startup form. Now click the "image" & enter the password into the dialog box.

This will open the DBA menu. Click the button to either Disable or Enable the Shift Key Design View Entry.
Yes = Shift Key Won't Work No = Shift Key Will Work

Clicking Yes will show the following image:

If you open the database while holding the Shift Key, you WILL NOT enter design mode. Clicking No will show the following image:

If you open the database while holding the Shift Key, you WILL enter design mode.

SharePoint Hill

Sources: Not another ms- access page! Albert D. Kallal


ShiftKeyDB.accdb (344k) Tammy Hill, Jun 5, 2012, 11:45 AM v.1

Comments
You do not have permission to add comments.

Sign in | Report Abuse | Print Page | Remove Access | Powered By Google Sites

Você também pode gostar