如何在Access中屏蔽Shift键?[ACCESS中国/OFFICE中国(access技...
来源:百度文库 编辑:神马文学网 时间:2024/05/10 20:16:12
禁止用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 调用方法: 建一个窗体,在某一按钮的单击事件中写如下代码: ChangeProperty "AllowBypassKey", 1, False 'false为禁止SHIFT键,TRUE为恢复
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 调用方法: 建一个窗体,在某一按钮的单击事件中写如下代码: ChangeProperty "AllowBypassKey", 1, False 'false为禁止SHIFT键,TRUE为恢复