|
表-权限表-窗体名
改成你自己的窗体名称
你可以新建一个窗体
放二个命令按钮:启用(Command1),禁用(Command0)
把下面的粘贴进去:
'设置方法:
'1)启用 SetBypassProperty True
'2)禁用 SetBypassProperty False
Private Sub Command0_Click()
SetBypassProperty False
End Sub
Private Sub Command1_Click()
SetBypassProperty True
End Sub
Function SetBypassProperty(Allow As Boolean)
Const DB_Boolean As Long = 1
If Allow = True Then
ChangeProperty "AllowBypassKey", DB_Boolean, True
MsgBox "启用Shift键设置成功!", vbInformation
Else
ChangeProperty "AllowBypassKey", DB_Boolean, False
MsgBox "禁用Shift键设置成功!", vbInformation
End If
End Function
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
Set prp = DBS.CreateProperty(strPropName, _
varPropType, varPropValue)
DBS.Properties.Append prp
Resume Next
Else
ChangeProperty = False
Resume Change_Bye
End If
End Function |
|