Function ap_DisableShift()
'This function disable the shift at startup. This action causes'the Autoexec macro and Startup properties to always be executed.OnErrorGoTo errDisableShift
Dim db As DAO.Database
Dim prop as DAO.PropertyConst conPropNotFound = 3270Set db = CurrentDb()
'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False'The function is successful.ExitFunction
errDisableShift:
'The first part of this error routine creates the "AllowByPassKey'property if it does not exist.If Err = conPropNotFound ThenSet prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)
db.Properties.Append prop
ResumeNextElse
MsgBox "Function 'ap_DisableShift' did not complete successfully."ExitFunctionEndIfEndFunctionFunction 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.OnErrorGoTo errEnableShift
Dim db as DAO.Database
Dim prop as DAO.PropertyConst conPropNotFound = 3270Set db = CurrentDb()
'This next line of code disables the SHIFT key on startup.
db.Properties("AllowByPassKey") = True'function successfulExitFunction
errEnableShift:
'The first part of this error routine creates the "AllowByPassKey'property if it does not exist.If Err = conPropNotFound ThenSet prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, True)
db.Properties.Append prop
ResumeNextElse
MsgBox "Function 'ap_DisableShift' did not complete successfully."ExitFunctionEndIfEndFunction
在 Visual Basic 編輯器中,單擊 [檢視] 功能表上的 [即時運算視窗]。
如果您想要停用 SHIFT 鍵,請在 [ 即時 運算] 視窗中輸入 ap_DisableShift,然後按 ENTER 鍵。 如果您想要啟用移位鍵,請在 [ 即時 運算] 視窗中輸入 ap_EnableShift,然後按 ENTER 鍵。