Results 1 to 7 of 7
  1. #1
    ajgarrison is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    3

    Disable Customize Quick Access Toolbar

    I have a database I need to deploy such that no user can gain access to the design or data in the database except what I have given through forms. I have success except for the users ability to customize the quick access toolbar. From this customization the user can add the design mode button. This not only allows them access to the design, but they can then close the forms and have full access to the tables and data.



    I have a custom Ribbon, my Switchboard is set up to Modal = Yes, I have a custom short cut menu with nothing in it so no ability to close there.

    How do you either disable the Customize Quick Access Toolbar or disable the More Commands on that menu OR any other suggestions?

    Regards,
    AJ

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I think the option is to employ a combination of things. There is a User DEfined Function that was created that you can use in your app. When you call it you can disable or enable things like MenuBar,s Nav Pane, Ribbon, etc. There is a pretty good discussion about it in this link. I founf Post #4 qand #7 interresting.
    https://www.accessforums.net/securit...lbar-3536.html

    A quick and easy way to get rid of everything is
    DoCmd.ShowToolbar "Ribbon", acToolbarNo

    Maybe you can play around with custom menus and use DoCmd.ShowToolbar to get what you are after.

  3. #3
    ajgarrison is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    3
    Thank you. I have tried and have not been successful so far with this method. There is a statement that with a combination of DoCmd statements and the code there was success. I don't know what these DoCmd statements would be. I've tried DoCMd.showtoolbar "ribbon" acToolbarNo
    That does not remove all menus.

    Here is my custom ribbon code: Ribbon = MyTab
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <ribbon startFromScratch="true">
    <tabs>
    <tab idMso = "TabHomeAccess" visible = "true"/>
    <tab idMso="TabCreate" visible="false" />
    <tab idMso = "TabDatabaseTools" visible = "false" />
    <tab idMso = "TabExternalData" visible = "false" />
    </tab>
    </tabs>
    </ribbon>
    </customUI>

    I have this function running AutoExec
    Public Function HideToolbar() As Boolean
    DoCmd.ShowToolbar "ribbon", acToolbarNo
    ChangeProperty "AllowFullMenus", DB_BOOLEAN, False 'Access Full Menus.
    ChangeProperty "AllowSpecialKeys", DB_BOOLEAN, False 'F11, ALT F11, etc.
    ChangeProperty "AllowBuiltInToolbars", DB_BOOLEAN, False 'Toolbars.
    ChangeProperty "AllowToolbarChanges", DB_BOOLEAN, False 'Prevent Changes.
    ChangeProperty "AllowBreakIntoCode", DB_BOOLEAN, False 'Code access.


    End Function

    On my Switchboard I have the Ribbon set to MyTab.

    I'm no programmer, just self taught Access thanks to groups like this. I appreciate all help provided.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    I have customized ribbon and have also disabled shortcut QAT with the db property settings: File > Options > Current Database > Ribbon and Toolbar Options.

    When the user opens db, the 'Customize Quick Access Toobar' option is disabled on the right click popup.

    Be aware that holding down the shift key while opening db will override project settings and bypass code execution, making the db fully available to user.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    As June mentioned, you can go into the settings and hide things like the Nav Pane. You can right Click the Ribbon to get there. It just depends on how secure you need it to be. If you can not trust the users at all and need to lock down your code, then I would suggest exploring accde.

    Here is a thread that has some additional code
    http://www.access-programmers.co.uk/...d.php?t=217085

    I will keep my eyes open. I think the combination of stuff mentioned here should cover most any need. What is not happening that you still need addressed?

  6. #6
    ajgarrison is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2013
    Posts
    3
    There must have been an issue with the order I was calling code. I now have the ribbon and qat hidden.

    Now my problem is my custom ribbon is not showing. June, how exactly do you have custom ribbon showing? I have it set in Access>Options. Not sure you can see below screen shot. But, Ribbon is MyTab Shortcut Menu is default and I have both Allow Full Menus and Allow Default Shortcut Menus checked.
    Click image for larger version. 

Name:	RibbonOptions.PNG 
Views:	72 
Size:	20.5 KB 
ID:	14609

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    I disable Full Menus, Default Shortcut Menus, and Navigation Pane.

    Here is how I set up custom ribbon http://forums.aspfree.com/microsoft-...at-303789.html

    My deployed db code is a bit different from that example. This code is in a module called Customization. I also have code to disable the application X close button.
    Code:
    Option Compare Database
    Option Explicit
    'API function to disable the X Close button is for 32-bit machine
    'If Lab gets 64-bit machines use the Unload event of Menu form to capture Access X close and Office button Exit
    Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal wRevert As Long) As Long
    Private Declare Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
    
    Sub OnRibbonLoad(ribbon As IRibbonUI)
        ' Callbackname in XML File "onLoad"
        DoCmd.OpenForm "Login"
    End Sub
    
    Public Sub RibbonButtonClick(CONTROL As IRibbonControl)
        Select Case CONTROL.ID
            Case "btnDates"
                DoCmd.OpenForm "ConcreteBreakDates"
            Case Else
                MsgBox "Button """ & CONTROL.ID & """ click", vbInformation, "Quick Access Toolbar"
        End Select
    End Sub
    
    Public Sub SetAccessXCloseButton(pfEnabled As Boolean)
    ' Comments: Control the Access close button.
    '           Disabling it forces the user to exit within the application
    ' In      : pfEnabled       TRUE enables the close button, FALSE disabled it
    ' Owner   : Copyright (c) 2008-2009 from FMS, Inc.
    ' Source  : Total Visual SourceBook
    ' Usage   : Permission granted to subscribers of the FMS Newsletter
    On Error Resume Next
    Const clngMF_ByCommand As Long = &H0&
    Const clngMF_Grayed As Long = &H1&
    Const clngSC_Close As Long = &HF060&
    Dim lngWindow As Long
    Dim lngMenu As Long
    Dim lngFlags As Long
    lngWindow = Application.hWndAccessApp
    lngMenu = GetSystemMenu(lngWindow, 0)
    If pfEnabled Then
      lngFlags = clngMF_ByCommand And Not clngMF_Grayed
    Else
      lngFlags = clngMF_ByCommand Or clngMF_Grayed
    End If
    Call EnableMenuItem(lngMenu, clngSC_Close, lngFlags)
    End Sub
    Here is the HTML in USysRibbons table.
    The first one is for my custom default ribbon and is set in the project Ribbon Name property. The second is for reports and is set in each report RibbonName property.
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad" >
      <commands>
        <command idMso="Help" enabled="false"/>
      </commands>
      <ribbon startFromScratch="true">
        <officeMenu>
          <button idMso="FileOpenDatabase" visible="false"/>
          <button idMso="FileNewDatabase" visible="false"/>
          <button idMso="FileCloseDatabase" visible="false"/>
        </officeMenu>
        <qat>
          <documentControls>
            <button idMso="DataRefreshAll"/>
          </documentControls>
        </qat>
      </ribbon>
    </customUI>
    ________________________
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
      <commands>
        <command idMso="Help" enabled="false"/>
      </commands>
      <ribbon startFromScratch="true">
        <officeMenu>
          <button idMso="FileOpenDatabase" visible="false"/>
          <button idMso="FileNewDatabase" visible="false"/>
          <button idMso="FileCloseDatabase" visible="false"/>
        </officeMenu>
        <qat>
          <documentControls>
             <button idMso="PrintDialogAccess"/>
          </documentControls>
        </qat>
      </ribbon>
    </customUI>
    Here is code behind my MainMenu form that calls the function to disable the X button:
    Code:
    Private Sub Form_Open(Cancel As Integer)
    Call SetAccessXCloseButton(False)
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Quick Access Toolbar Greyed out?
    By Nyolls in forum Access
    Replies: 1
    Last Post: 10-09-2013, 09:25 AM
  2. Disable/Hide Quick Access Toolbar
    By Jackal in forum Security
    Replies: 10
    Last Post: 11-22-2012, 05:25 PM
  3. Toolbar available in Access Runtime
    By sabre1 in forum Access
    Replies: 0
    Last Post: 03-02-2011, 10:13 AM
  4. Replies: 1
    Last Post: 06-20-2010, 05:04 AM
  5. Access 2007 menu bar, toolbar...
    By truthseeker170 in forum Security
    Replies: 1
    Last Post: 07-15-2009, 01:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums