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作者: 淡若远山 时间: 2010-4-20 11:26
非常感谢asklove 的热心回答。