Disable the Shift key

G

Guest

Hi all,

Did any one know how to disable the Shift key of a Access Database Project
file (.adp)? What i want is that the user of the adp file could not open the
file with anymore.

Best regards,

Patrick
 
D

David Lloyd

Patrick:

The following KB articles may be useful.

http://support.microsoft.com/default.aspx?scid=kb;en-us;826765
http://msdn.microsoft.com/library/d...aac11/html/acproAllowBypassKey_HV05186992.asp

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hi all,

Did any one know how to disable the Shift key of a Access Database Project
file (.adp)? What i want is that the user of the adp file could not open the
file with anymore.

Best regards,

Patrick
 
G

Guest

Hi ,
On a form called PasswordForm form you can protect the ability to enable
disable by usign a password requirements code as follows create a button
called "shift key" and set the click event to
Private Sub shift_key_Click()
On Error GoTo Err_shift_key_Click

Dim stDocName As String
Dim stLinkCriteria As String

Dim message As String
Dim retval

message = "Please Enter Password"
retval = InputBox(Prompt:=message, Title:="Administrator Use Only")

If retval = "yourpassword" Then
stDocName = "ShiftKeyStatus"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Else

MsgBox ("Sorry, that password is incorrect.Please try again.")

End If


Exit_shift_key_Click:
Exit Sub

Err_shift_key_Click:
MsgBox Err.Description
Resume Exit_shift_key_Click

End Sub


Hi Again

Okay Now Create a form called ShiftKeyStatus
Enter the following code


Option Compare Database
Option Explicit

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click


Screen.PreviousControl.SetFocus
DoCmd.FindNext

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub


Private Sub CloseFormShiftKeyStatus_Click()
On Error GoTo Err_CloseFormShiftKeyStatus_Click


DoCmd.Close

Exit_CloseFormShiftKeyStatus_Click:
Exit Sub

Err_CloseFormShiftKeyStatus_Click:
MsgBox Err.Description
Resume Exit_CloseFormShiftKeyStatus_Click

End Sub
'********************************************************
'This Code Disables the Shift Key
'
Private Sub Disable_Shift_Key_Click()
On Error GoTo Err_Disable_Shift_Key_Click


Dim db As Database
Dim prp As Property
Set db = CurrentDb
Set prp = db.CreateProperty("AllowByPassKey", dbBoolean, False)
db.Properties.append prp

Exit_Disable_Shift_Key_Click:
Exit Sub

Err_Disable_Shift_Key_Click:
MsgBox ("Shift Key Has Already Been Disabled")
Resume Exit_Disable_Shift_Key_Click

End Sub
'********************************************************

'********************************************************
'This Code Re-enables the Shift Key
'
Private Sub Enable_Shift_Key_Click()
On Error GoTo Err_Enable_Shift_Key_Click

Dim db As Database
Set db = CurrentDb
db.Properties.Delete "AllowByPassKey"
db.Properties.Refresh

Exit_Enable_Shift_Key_Click:
Exit Sub

Err_Enable_Shift_Key_Click:
MsgBox ("Shift Key Has Already Been Enabled")
Resume Exit_Enable_Shift_Key_Click

End Sub
'********************************************************

Private Sub Form_Open(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "PasswordForm"
DoCmd.Close acForm, stDocName

End Sub

This is working for me
Rgds
Nobleman
 

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