title: Disabling Design View in MS Access
body: <p>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.</p>
  
  <p>The following code works with one exception:</p>
  
  <pre><code>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 = "&amp;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
  </code></pre>
  
  <p>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.</p>