Question Loading Ribbons

msowards

Registered User.
Local time
Today, 00:05
Joined
Feb 16, 2012
Messages
21
I have a little app that I locked down very tight in Access 2007. However a test run with access 2010 shows there was a security hole. It has to do with Ribbons. In Access 2007 I turned off all the developer ribbons and allowed the compact and repair button on a customized ribbon when the user brought up the maintenance form. Yet when I opened the database in programmer mode all the ribbons were now accessible. However, in 2010 the FILE tab ribbon must now be turned off at the current DB level (turning it off for all forms). And it's still off when I open in programmer mode. This leads me to ask a few questions...
Is it possible to set the default CurrentDB ribbon in VBA to take affect on next run? Or is it best to make a new tab that displays when the maintenance form displays. And finally what is the new method of calling the Compact and repair from VBA in 2010? (sendkeys FMC didn't work so well any more)?
 
Hi

Create a button to compact and repair, according to question 16

http://www.ribbons-access.com/ms-access/ribbon-support-faq.asp#inicio

To open mode structure of the BD, just hold down the SHIFT key. All the ribbons will appear normally.

To set the FILE TAB must use the tag <backstage> ... </ backstage>

Example:

Code:
<customUI xmlns="[URL]http://schemas.microsoft.com/office/2009/07/customui[/URL]">
<!-- *** TAG COMMANDS  ***-->
<commands>
   <command idMso="Help" enabled = "false"/>
</commands>
<ribbon startFromScratch="true">
...
...
...
</ribbon>
 
<!-- *** BACKSTAGE ***-->
<backstage>
<button idMso="FileSave" visible="false"/>
<button idMso="SaveObjectAs" visible="false"/>
<button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
<button idMso="FileOpen" visible="false"/>
<button idMso="FileCloseDatabase" visible="false"/>
<tab idMso ="TabInfo" visible="false"/>
<tab idMso ="TabRecent" visible="false"/>
<tab idMso ="TabNew" visible="false"/>
<tab idMso ="TabPrint" visible="false"/>
<tab idMso ="TabShare" visible="false"/>
<tab idMso ="TabHelp" visible="false"/>
<button idMso="ApplicationOptionsDialog" visible="false"/>
<button idMso="FileExit" visible="false"/>
</backstage>
 
</customUI>
Create a ribbon for each version > Use a common table (tblRibbons) to store the ribbons > Load the ribbon at startup, calling a function by the AutoExec macro, depending on the version of Access.

Example Function:

Code:
Public Function fncLoadRibbon()
Dim rsRib As DAO.Recordset
Dim strSql As String
 
strSql = "SELECT * FROM tblRibbons WHERE version=1214 or version=" & Val(Application.Version)
Set rsRib = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
Do While Not rsRib.EOF
    Application.LoadCustomUI rsRib!RibbonName, rsRib!RibbonXml
    rsRib.MoveNext
Loop
rsRib.Close
Set rsRib = Nothing
 
End Function
 
Last edited:
Thanks! I've not dealt with the AutoExec before. I'm not sure how to initiate it. What is the main diff between AutoExec and a Startup form's events?
So, I'm pretty close to what I want already, but I can always use some external input. The load UI function could be used at close to reset the default ribbon and that would take effect on next opening, right?
I my ribbon re-write below I've created a new tab and put file save (a test) and the Compact and Repair button on it. How do I programmaticlly execute this button from VBA?

Code:
   <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
   <ribbon startFromScratch ="false">
    <tabs>
      <tab id="AcctTrkr1" label="Maint">
        <group id="T1G1" label="Group1">
         <button idMso="FileSave" visible="true"/> 
     <button idMso="FileCompactAndRepairDatabase" label="Compact" visible="true" />
        </group>
       </tab>
    </tabs>
  </ribbon>

  <backstage>
<button idMso="ApplicationOptionsDialog" visible="false"/>
    <tab idMso="TabInfo" visible="false"/>
    <button idMso="SaveObjectAs" visible="false"/>
    <button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
    <button idMso="FileOpen" visible="false"/>
      <button idMso="FileSave" visible="false"/> 
  <button idMso="FileCloseDatabase" visible="false"/>
    <tab idMso="TabHomeAccess" label="Home" visible="true" />
    <tab idMso="TabCreate" label="Create" visible="false" />
    <tab idMso="TabExternalData" label="External Data" visible="false" />
    <tab idMso="TabDatabaseTools" label="Database Tools" visible="false" />
    <tab idMso="TabRecent" visible="false"/>
    <tab idMso="TabNew" visible="false"/>
    <tab idMso="TabPrint" visible="false"/>
    <tab idMso="TabShare" visible="false"/>
    <tab idMso="TabHelp" visible="false"/>
    <button idMso="FileExit" visible="true"/>
  </backstage>
   </customUI>
Thanks for your input!!
 

Users who are viewing this thread

Back
Top Bottom