【发布时间】:2018-03-10 13:03:15
【问题描述】:
我使用来自Microsoft 的代码禁用了我的访问项目(.accdb) 的启动选项。在我输入即时窗口以禁用转移键后,它就起作用了。
但是我怎样才能再次启用 shift 键,因为我不能再使用代码了,因为它现在被隐藏了,我现在只能看到这个。
知道如何再次查看即时窗口以启用 shift 键吗?
【问题讨论】:
我使用来自Microsoft 的代码禁用了我的访问项目(.accdb) 的启动选项。在我输入即时窗口以禁用转移键后,它就起作用了。
但是我怎样才能再次启用 shift 键,因为我不能再使用代码了,因为它现在被隐藏了,我现在只能看到这个。
知道如何再次查看即时窗口以启用 shift 键吗?
【问题讨论】:
从另一个数据库中的 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
【讨论】: