With one Access 2010 app, can't hide ribbon using DoCmd.ShowToolbar "Ribbon", acToolbarNo

With one Access 2010 app, can't hide ribbon using DoCmd.ShowToolbar "Ribbon", acToolbarNo

I have an app that I've converted from Access 2003 mdb to Access 2010 hybrid (local accdb and sharepoint) which does not respond to DoCmd.ShowToolbar "Ribbon", acToolbarNo as it should. There is no autoexec macro at this point, so I can test.

I created a completely new form with DoCmd.ShowToolbar "Ribbon", acToolbarNo in every On Open On Load etc type event, set it as the startup form, and the app still shows the ribbon. I put a button on the new form (which has nothing else) that runs DoCmd.ShowToolbar "Ribbon", acToolbarNo and it does not hide the ribbon.

Yet if I hold down the shift key when starting the app, and then load that test page, the ribbon is hidden.

Since there is no autoexec, what could be making the difference? I've adjusted nearly every setting in File Options and none have an impact. Coming at it from the other side, I created a new accdb and have tried to create the problem by adjusting everything in File Options. But nothing I do in the test db will repro the issue.

I found one posting about an issue like this

http-://www.eggheadcafe.-com/software/aspnet/36130096/hide-ribbon-event-not-working.aspx

The fix he came up with was to recreate the db from scratch. I can't do that.

It's almost as if there is some startup property that was set in Access 2003 before conversion and which no longer has a control point in Access 2010.

This little bit did it

Function ResetStartupProperties()
    ChangeProperty "StartupForm", dbText, ""
    ChangeProperty "StartupShowDBWindow", dbBoolean, True
    ChangeProperty "StartupShowStatusBar", dbBoolean, True
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, True    
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, True
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True
    MsgBox "Startup Properties UnSet"
End Function

I guess the AllowBuiltinToolbars setting was defeating the ribbon hide command. There is no interface to that property in the Access environment.

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright