我使用Microsoft中的代码禁用了访问项目(.accdb)的启动选项。在我输入即时窗口以禁用切换键后,它工作正常。
但是我怎么能再次启用shift键,因为我现在不能再使用代码,因为它现在已经隐藏了,我现在能看到的就是这个。
任何想法如何再次查看立即窗口以启用shift键?
答案 0 :(得分:2)
从另一个数据库中的VBA代码启用旁路键。如果还禁用Alt-F11等特殊键,这将是唯一的方法。以下是Microsoft site的修改代码。在另一个数据库中创建此函数并修改受保护数据库的路径:
Function ap_EnableShift()
'This function enables the SHIFT key at startup. This action causes
'the Autoexec macro and the Startup properties to be bypassed
'if the user holds down the SHIFT key when the user opens the database.
On Error GoTo errEnableShift
Dim db As DAO.Database
Dim prop As DAO.Property
Const conPropNotFound = 3270
Set db = OpenDatabase("C:\path\tst.accdb")
'This next line of code enables the SHIFT key on startup.
db.Properties("AllowByPassKey") = True
'function successful
Exit Function
errEnableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, True)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If
End Function