ACCCESS打开时,按住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
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
ChangeProperty = False
End If
End Function
ADP中写法
CurrentProject.properties.add "AllowBypassKey" , false
如何在启动窗口打开事件中添加如下代码
Dim Strmde As String
On Error Resume Next
ChangeProperty "AllowBypassKey", 1, False 'False为禁止Shift键,True为恢复