设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2099|回复: 3
打印 上一主题 下一主题

ADP中怎样禁用shfit键

[复制链接]
跳转到指定楼层
1#
发表于 2004-9-19 05:24:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
使用 AllowBypassKey 属性可以指定是否允许用 Shift 键来忽略启动属性和 AutoExec 宏。


  • 在 [url=mkMSITStore:E:\Program%20Files\Microsoft%20Office\OFFICE11\2052\vbaac10.chm::/html/acproAllowBypassKey.htm#]Microsoft Access 数据库[/url] (.mdb) 中,可以通过使用 CreateProperty 方法添加该属性,并将其追加到 Database 对象的 Properties 集合中。




  • 在 [url=mkMSITStore:E:\Program%20Files\Microsoft%20Office\OFFICE11\2052\vbaac10.chm::/html/acproAllowBypassKey.htm#]Microsoft Access 项目[/url] (.adp) 中,可以通过使用 [url=mkMSITStore:E:\Program%20Files\Microsoft%20Office\OFFICE11\2052\vbaac10.chm::/html/acmthAdd.htm]Add[/url] 方法将该属性添加到 CurrentProject 对象的 AccessObjectProperties 集合中。


说明

调试应用程序时,应确保 AllowBypassKey 属性设为 True

该属性的设置仅在下一次打开应用程序数据库时才会生效。

示例

下面的示例显示了一个名为 SetBypassProperty 的过程,该过程传递要设置的属性的名称、数据类型及所需设置。一般用途过程 ChangeProperty 将尝试设置 AllowBypassKey 属性,如果找不到该属性,则用 CreateProperty 方法将其追加到 Properties 集合中。这是必要的步骤,因为只有在添加之后,该属性才出现在 Properties 集合中。
  1. Sub SetBypassProperty()

  2. Const DB_Boolean As Long = 1

  3.     ChangeProperty "[b]AllowBypassKey[/b]", DB_Boolean, False

  4. End Sub



  5. Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer

  6.     Dim dbs As Object, prp As Variant

  7.     Const conPropNotFoundError = 3270



  8.     Set dbs = CurrentDb

  9.     On Error GoTo Change_Err

  10.     dbs.Properties(strPropName) = varPropValue

  11.     ChangeProperty = True



  12. Change_Bye:

  13.     Exit Function



  14. Change_Err:

  15.     If Err = conPropNotFoundError Then    ' Property not found.

  16.         Set prp = dbs.CreateProperty(strPropName, _

  17.             varPropType, varPropValue)

  18.         dbs.Properties.Append prp

  19.         Resume Next

  20.     Else

  21.         ' Unknown error.

  22.         ChangeProperty = False

  23.         Resume Change_Bye

  24.     End If

  25. End Function
复制代码
[code][/code]

  怎样用ADD的方法添加属性?

[此贴子已经被作者于2004-9-18 21:26:53编辑过]

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
发表于 2004-9-19 07:37:00 | 只看该作者
3#
 楼主| 发表于 2004-9-19 08:05:00 | 只看该作者
谢谢站长
4#
发表于 2004-9-24 01:23:00 | 只看该作者
学习。学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-5 08:29 , Processed in 0.084139 second(s), 27 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表