首页 > 数据库 >ACCESS 禁止用户使用SHIFT启动数据库

ACCESS 禁止用户使用SHIFT启动数据库

时间:2023-08-11 18:45:42浏览次数:38  
标签:Function SHIFT 数据库 db prop ACCESS ap AllowByPassKey

这是官方链接,不要去各种百度了: 在数据库中强制实施或禁用启动选项 - Office | Microsoft Learn

'1.启动访问。

'2.创建新模块,然后添加以下两个函数:

Function ap_DisableShift()
'This function disable the shift at startup. This action causes
'the Autoexec macro and Startup properties to always be executed.

On Error GoTo errDisableShift

Dim db As DAO.Database
Dim prop as DAO.Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False

'The function is successful.
Exit Function

errDisableShift:
'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, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If

End Function

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 = CurrentDb()

'This next line of code disables 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
'3.在 Visual Basic 编辑器中,单击“视图”菜单上的“即时窗口”。

'4.如果要禁用 SHIFT 密钥,请在“ 即时 ”窗口中键入ap_DisableShift,然后按 Enter。 如果要启用班次键,请在 “即时 ”窗口中键入ap_EnableShift,然后按 ENTER。

这里要提醒一下大家,因为这是官方的资料,也就是说,谁都能看得到,所以最好把 ap_DisableShift 和 ap_EnableShift 这两个函数改成只有自己知道的函数,加强防范

标签:Function,SHIFT,数据库,db,prop,ACCESS,ap,AllowByPassKey
From: https://www.cnblogs.com/yoooos/p/17623729.html

相关文章

  • 通过python的pymongo连接MongoDB数据库最新方式
    首先导入需要的模块功能fromurllibimportparsefrompymongoimportMongoClient使用pymongo的客户端进行链接self.host="168.9.5.27"self.port=27017self.user="Mr.baba"self.password="PLA_No.1"......
  • Mysql 查看数据库大小并保持小数点两位
    SELECT table_schema'DataBaseName', ROUND( SUM(data_length+index_length)/1024/1024/1024,2)'数据库大小(GB)'FROM information_schema.TABLESGROUPBY table_schema;......
  • 数据库数据下载
    importpymysqlconn=pymysql.connect(host="127.0.0.1",user="root",password="root",charset="utf8")cursor=conn.cursor(cursor=pymysql.cursors.DictCursor)cursor.execute("SHOWDATABASES;")databases=......
  • 利用ssh 隧道代理服务器本地端口,实现远程连接服务器本地数据库
    ssh隧道代理写这篇文章的原因是因为在开发中,遇到了需要对线上服务器数据进行调试,为方便在本地使用图形化工具。mysql,redis总所周知是不允许远程连接数据库的,我们就无法在本地对服务器数据进行调试。所以就可以利用ssh工具进行隧道代理本地调试数据。废话不多说直接开干,上代码......
  • 数据库数据恢复-Oracle ASM数据恢复案例
    数据库数据恢复环境:Oracle数据库ASM磁盘组有4块成员盘。数据库故障&分析:Oracle数据库ASM磁盘组掉线,ASM实例无法挂载,用户联系我们要求恢复oracle数据库。数据库数据恢复工程师拿到磁盘后,先将所有磁盘以只读方式进行扇区级别的镜像备份,后续的数据分析和数据恢复都基于镜像文件进......
  • 记录一次数据库连接数超限问题(ArcSDE)
    环境:Oracle11.2.0.4RAC集群  ArcGIS10.1问题说明:服务器间歇性的会报连接数超限的问题,经常需要手动释放部分连接才能解决。之前遇到过类似的问题,主要是增大数据库连接数,同时检查死链接的情况,因为修改配置需要重启数据库,所以前期一直手动释放连接,待其他操作再一起重启数据库。......
  • 使用awk分析nginx访问日志access.log
    1.awk简介awk是一种编程语言,用于在linux/unix下对文本和数据进行处理。数据可以来自标准输入、一个或多个文件,或其它命令的输出。它支持用户自定义函数和动态正则表达式等先进功能,是linux/unix下的一个强大编程工具。它在命令行中使用,但更多是作为脚本来使用。awk的处理文本和数......
  • 数据库个人笔记(持续更新中)
    第一章绪论1.1数据库系统概述数据(Date)数据库(DB):长期储存在计算机中,有组织、可共享的大量数据集合。具有低冗余度、高数据独立性、易扩展的特点数据库管理系统(DBMS):是计算机基础软件,有以下几个功能:数据定义功能,提供数据定义语言(DDL)数据组织、存储和管理数据操作功能,提供数......
  • 神通数据库根据归档日志恢复数据
    1、执行这个sql语句;CREATETABLET_TMPASSELECTversions_xidXID,versions_startscnSTART_SCN,versions_starttimeSTART_TIME,versions_endscnEND_SCN,versions_endtimeEND_TIME,versions_operationOPERATION,IDFROMTJ_ARCH_GC.T_AR_FPDA_FILEVERSIONSBETWEEN......
  • centos 安装下载mongodb数据库
    mongodb下载安装官网:https://www.mongodb.com/try/download/communitytar-zxvfmongodb-linux-x86_64-rhel70-4.4.17.tgzmvmongodb-linux-x86_64-rhel70-4.4.17/usr/local/mvmongodb-linux-x86_64-rhel70-4.4.17/mongodbcd/usr/local/mongodbmkdirdatalogscd......