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:
And I have my AutoExec call the function as such:
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:
I don't think there's anything wrong with it. Any ideas?
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
Code:
Public Function AutoExec()
DoCmd.RunCommand LoadRibbonsADP()
End Function
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <ribbon startFromScratch="true"/></customUI>