在 MS Access 中禁用设计视图 [英] Disabling Design View in MS Access

查看:38
本文介绍了在 MS Access 中禁用设计视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除非满足特定的权限要求,否则我正在尝试输入一些隐藏设计视图"的代码作为我们内部应用程序的选项.

I'm trying to input some code that hides "Design View" as an option for our internal application unless a certain permission requirement is met.

以下代码有一个例外:

On Error Resume Next
If Not GetUserInfo("ADMIN_PERMIS") = 1 Then
    Dim cb As CommandBar
    Dim cbCtl As CommandBarControl
    For Each cb In CommandBars
        If cb.type = msoBarTypePopup Then
            For Each cbCtl In cb.Controls
                If cbCtl.Caption = "&Design View" Then
                    cbCtl.enabled = True
                    cbCtl.visible = False
                Else
                    cbCtl.visible = True
                End If
            Next
        End If
    Next
    Set cb = Nothing: Set cbCtl = Nothing
End If

这样做的一个问题是它不仅禁用了当前数据库的设计视图,而且禁用了启动的任何其他访问数据库.我正在寻找一种方法来尝试应用此代码,使其仅影响我拥有该代码的 Access 数据库,而不影响它的每个实例.

The one problem with this is that it disables Design View not only for the current database, but also for any other access database that is launched. I'm looking for a way to try and apply this code in such a way that it only affects the Access database I have the code in and not in every single instance of it.

推荐答案

我建议将数据库转换为已编译的、仅可执行的 .accde 文件(文件 --> 保存和发布 --> 制作 ACCDE).这样做将防止应用程序中的任何设计或代码更改.以正常的 .accdb 格式保留开发版本.在那里进行更改,然后为每次更新编译成 .accde 版本.

I recommend converting the database into a compiled, executable only .accde file (File --> Save & Publish --> Make ACCDE). Doing this will prevent any design or code changes in the application. Keep a development version in the normal .accdb format. Make your changes there and then compile into the .accde version for each update.

由于您的团队经常更新数据库,您可以从使用 Peter De Baets 的 数据库启动器中受益.数据库启动器制作数据库前端的本地副本,允许用户在进行设计更改时继续工作.生产acde前端文件更新后,用户下次打开数据库时会自动复制新文件.在我的办公室里,我发现我可以推出一个快速修复程序,只需通过电子邮件给每个人说关闭并重新打开数据库!".

Since your team updates the database often, you could benefit from using Peter De Baets' database starter. The database starter makes a local copy of the front end of the database, allowing uses to continue to work while design changes are being made. After the production accde front end file is updated, the users will automatically copy the new file the next time they open the database. In my office I have found that I can push out a quick fix and simply email everyone saying "Close and reopen the database guys!".

这篇关于在 MS Access 中禁用设计视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆