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

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

问题描述

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

以下代码具有一个例外:

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数据库,而不会影响它的每个实例.

我建议将数据库转换为仅可编译的,可执行的.accde文件(文件->保存并发布->创建ACCDE).这样做将防止应用程序中的任何设计或代码更改.保持标准.accdb格式的开发版本.在此处进行更改,然后针对每次更新编译为.accde版本.

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

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.

The following code works with one exception:

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

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.

解决方案

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.

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天全站免登陆