用编程实现屏蔽进Access时的shift键
在任何一窗体中加入以下代码:
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
复制代码
做个按钮cmd1
ChangeProperty "AllowBypassKey", 1, False 'false为禁止SHIFT键,TRUE为恢复
复制代码
做个按钮cmd2
- ChangeProperty "AllowBypassKey", 1, True 'TRUE为恢复shift
复制代码
[此贴子已经被作者于2005-11-26 20:53:40编辑过]
|