How to Hide Ribbon in ADP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bullfrog83
    New Member
    • Apr 2010
    • 124

    #1

    How to Hide Ribbon in ADP

    I'm trying to hide the ribbon in an Access Data Project. I have a sql table called USysRibbon with the fields RibbonName and RibbonXML.

    This is the function that loads the ribbon:

    Code:
    Function LoadRibbonsADP()
    On Error GoTo Error_Handler
    
        Dim rs As ADODB.Recordset
        Dim i As Integer
        
        'open the table containing ribbons.
        Set rs = New ADODB.Recordset
        rs.CursorLocation = adUseServer
        rs.Open "SELECT * FROM USysRibbons", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
        
        'load the ribbons
        While Not rs.EOF
            Application.LoadCustomUI rs!RibbonName.Value, rs!RibbonXML.Value
            rs.MoveNext
        Wend
        
    Exit_Procedure:
        If Not rs Is Nothing Then
            rs.Close
        End If
        Set rs = Nothing
    
        Exit Function
    
    Error_Handler:
        If Err = 32609 Then
            MsgBox "The specified ribbon is already loaded", vbExclamation
            Resume Next
        Else
            MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
            Resume Exit_Procedure
        End If
    End Function
    And I have my AutoExec call the function as such:

    Code:
    Public Function AutoExec()
    
        DoCmd.RunCommand LoadRibbonsADP()
    
    End Function
    In the Access Options dialog box I set the Ribbon Name = HideTheRibbon. However, when I open my app the ribbon still shows. I have the following xml in the RibbonXML column:

    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <ribbon startFromScratch="true"/></customUI>
    I don't think there's anything wrong with it. Any ideas?
    Last edited by bullfrog83; Aug 26 '10, 07:01 PM. Reason: Problem changed
Working...