|
禁止用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为恢复 |
|