Search code examples
vbams-access

MSAccess - Minimize the Toolbar Ribbon OnLoad()?


I'm looking for a reliable method to minimize the default MSAccess Toolbar Ribbon during the OnLoad() event.

I realize can totally HIDE the toolbar, but that's not exactly what I am looking to do - I just want to minimize the ribbon:

DoCmd.ShowToolbar "Ribbon", acToolbarNo    'Hides the full toolbar
DoCmd.ShowToolbar "Ribbon", acToolbarYes   'Show

I've tried a couple approaches, with mixed success:

In Access 2010 & 2013 (VB7):

CommandBars.ExecuteMso "MinimizeRibbon"

Earlier Versions:

SendKeys "^{F1}", False

Both of these approaches appear to operate as a TOGGLE between sessions. Is there a method to determine the current state and then apply the appropriate code?

I have users with Access: 2007, 2010, 2013

Thanks for any suggestions!

Mark


Solution

  • Check out this answer on MSDN. He shares a few different ways to go about it, including a sample database.

    E.G. In Access 2010 you can change the Ribbon state with:

    CommandBars.ExecuteMso "MinimizeRibbon"
    

    http://social.msdn.microsoft.com/Forums/office/en-US/2f0d95a8-ed5f-4007-831d-05ef7e7a4263/minimize-the-ribbon-at-access-startup-using-vba

    He links within:

    http://www.accessribbon.de/en/index.php?FAQ:19

    http://www.accessribbon.de/en/index.php?Downloads:15

    Based on what access is being used, you could use different functions, perhaps.

    Taking this from - http://windowssecrets.com/forums/showthread.php/142262-How-to-find-Access-version-in-code:

    Public Function AccessVersionID() As String
    
    
       Select Case SysCmd(acSysCmdAccessVer)
         Case 7: AccessVersionID = "95"
         Case 8: AccessVersionID = "97"
         Case 9: AccessVersionID = "2000"
         Case 10: AccessVersionID = "2002"
         Case 11: AccessVersionID = "2003"
         Case 12: AccessVersionID = "2007"
         Case 13: AccessVersionID = "Pirated!"
         Case 14: AccessVersionID = "2010"
         Case 15: AccessVersionID = "2013"
         Case Else: AccessVersionID = "Unknown"
       End Select
    
     End Function            'AccessVersionID()