Results 1 to 3 of 3
  1. #1
    lzook88 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    75

    Question Creating Custom RibbonUI

    Hey all.. I am working on creating the UI for my access database. However I can not get it to show up.. Here is all my info..

    I have created a table called "USysRibbons"

    RibbonID | RibbonName | RibbonXML
    2 | Admin |

    The XML is as follows:
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad" >
      <ribbon startFromScratch="True">
        <officeMenu>
          <button idMso="FileOpenDatabase" visible="false"/>
          <button idMso="FileNewDatabase" visible="false"/>
          <button idMso="FileCloseDatabase" visible="false"/>
        </officeMenu>
        <tabs>
            <tab id="tabAdmin" label="ADMIN" getvisible="adminTabGetVisible">
                <group id="grpAUser" label="User">
                   <button id="btnChPW" size="large" label="Change Password" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                   <button id="btnRstUser" size="large" label="Reset User" imageMso="ResetCurrentView" onaction="RibbonButtonClick"/>
                </group>
            </tab>
            <tab id="tabCertifications" label="CERTIFICATIONS">
                <group id="grpCertifications" label="Certifications">
                    <button id="btnCertAdd" size="large" label="Add Certification" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                    <button id="btnCertEdit" size="large" label="Edit Certification" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                </group>
                <group id="grpCertType" label="Certification Type">
                </group>
                <group id="grpCertReports" label="Reports">
                </group>
            </tab>
            <tab id="tabClinicals" label="CLINICALS">
                <group id="grpClinCal" label="Calendar">
                </group>
                <group id="grpClinLoc" label="Locations">
                </group>
                <group id="grpClinEmails" label="Emails">
                </group>
                <group id="grpClinMy" label="My Clinicals">
                </group>
            </tab>
            <tab id="tabEMTs" label="EMTS">
                <group id="grpClinCal" label="EMTs">
                </group>
            </tab>
            <tab id="tabEMTs" label="INVENTORY">
                <group id="grpInvItems" label="Items">
                </group>
                <group id="grpInv" label="Inventory">
                </group>
                <group id="grpInvTran" label="Transfer">
                </group>
                <group id="grpInvReport" label="Reports">
                </group>
                <group id="grpInvSheets" label="Inventory Sheets">
                </group>
            </tab>
            <tab id="tabEMTs" label="INVENTORY">
                <group id="grpUnits" label="Units">
                </group>
            </tab>
        </tabs>
      </ribbon>
    </customUI>
    and then I have this code in a standard module called "CustomRibbon"

    Code:
    Sub OnRibbonLoad(Ribbon As IRibbonUI)
        ' Callbackname in XML File "onLoad"
        DoCmd.OpenForm "frmDummy"
        DoCmd.Close acForm, "frmDummy"
    End Sub
    
    
    Public Sub RibbonButtonClick(control As IRibbonControl)
        Select Case control.ID
            Case "btnChPW"
                DoCmd.OpenForm "frmUserInfo", , , "[tblUsers]![HashID]=fOSUserName()", acFormEdit, acDialog
            Case "btnRstUser"
                DoCmd.OpenForm "ResetUser", , , , acFormEdit, acDialog
            Case "btnCertAdd"
                DoCmd.OpenForm "AddCertification", , , , acFormAdd, acDialog
            Case "btnCertEdit"
                DoCmd.OpenForm "EditCertification", , , , acFormEdit, acDialog
            Case Else
                MsgBox "Button """ & control.ID & """ click", vbInformation, "Quick Access Toolbar"
        End Select
    End Sub
    
    
    Public Sub adminTabGetVisible(control As IRibbonControl, ByRef returnVal)
    
    Dim UserN As Variant
    Dim UserS As Variant
    
    'find UserID
    UserN = DLookup("UserID", "tblUsers", "HashID= '" & fOSUserName() & "'")
    
    'find User's security status
    UserS = DLookup("UserSecurity", "tblUsers", "HashId = '" & fOSUserName() & "'")
    
        Select Case control.ID
            Case "tabAdmin"
                If UserS = 1 Then
                    returnVal = True
                Else
                    returnVal = False
                End If
        End Select
    
    End Sub
    I have gone into the current database options and changed the the ribbon name to ADMIN but it will still not show up!..

    Any help would be great?

  2. #2
    bigot is offline Advanced...ish
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    37
    Here's a list of problems:
    1. My ribbon tables have "ID" not "RibbonID" - not sure if this matters
    2. Line #2: booleans must be all lowercase
      Code:
      startFromScratch="true"
    3. Line #9: fix your serialization
      Code:
      getVisible="adminTabGetVisible"
    4. Line #12: fix your serialization
      Code:
      onAction="RibbonButtonClick"
    5. Lines #26, #36: both use
      Code:
      id="grpClinCal"
      IDs must be unique
    6. Lines #35, #39, #51: all use
      Code:
      id="tabEMTs"
      IDs must be unique






    Fixed XML:
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad" >
      <ribbon startFromScratch="true">
        <officeMenu>
          <button idMso="FileOpenDatabase" visible="false"/>
          <button idMso="FileNewDatabase" visible="false"/>
          <button idMso="FileCloseDatabase" visible="false"/>
        </officeMenu>
        <tabs>
            <tab id="tabAdmin" label="ADMIN" getVisible="adminTabGetVisible">
                <group id="grpAUser" label="User">
                   <button id="btnChPW" size="large" label="Change Password" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                   <button id="btnRstUser" size="large" label="Reset User" imageMso="ResetCurrentView" onAction="RibbonButtonClick"/>
                </group>
            </tab>
            <tab id="tabCertifications" label="CERTIFICATIONS">
                <group id="grpCertifications" label="Certifications">
                    <button id="btnCertAdd" size="large" label="Add Certification" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                    <button id="btnCertEdit" size="large" label="Edit Certification" imageMso="EncryptMessage" onAction="RibbonButtonClick"/>
                </group>
                <group id="grpCertType" label="Certification Type">
                </group>
                <group id="grpCertReports" label="Reports">
                </group>
            </tab>
            <tab id="tabClinicals" label="CLINICALS">
                <group id="grpClinCal" label="Calendar">
                </group>
                <group id="grpClinLoc" label="Locations">
                </group>
                <group id="grpClinEmails" label="Emails">
                </group>
                <group id="grpClinMy" label="My Clinicals">
                </group>
            </tab>
            <tab id="tabEMTs" label="EMTS">
                <group id="grpClinCal2" label="EMTs">
                </group>
            </tab>
            <tab id="tabEMTs2" label="INVENTORY">
                <group id="grpInvItems" label="Items">
                </group>
                <group id="grpInv" label="Inventory">
                </group>
                <group id="grpInvTran" label="Transfer">
                </group>
                <group id="grpInvReport" label="Reports">
                </group>
                <group id="grpInvSheets" label="Inventory Sheets">
                </group>
            </tab>
            <tab id="tabEMTs3" label="INVENTORY">
                <group id="grpUnits" label="Units">
                </group>
            </tab>
        </tabs>
      </ribbon>
    </customUI>

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    My advice to others that might read this string is that modifying the ribbon often does not have a positive ROI - return on investment - which is to say it takes an inordinate amount of effort for the results achieved.... it is simpler, faster and more easily tested to simply make the ribbon not visible and implement the features needed within the user interface (i.e. form). Having said that - it depends on what features are needed.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Creating a custom task schedule
    By azdjedi in forum Programming
    Replies: 4
    Last Post: 04-14-2014, 12:48 PM
  2. Creating Custom Fields
    By RudeRam in forum Queries
    Replies: 3
    Last Post: 08-01-2011, 01:09 PM
  3. creating custom switchboard
    By cnstarz in forum Forms
    Replies: 0
    Last Post: 05-25-2011, 12:18 AM
  4. Creating Custom Ribbons
    By disco_stu in forum Access
    Replies: 1
    Last Post: 07-13-2010, 06:10 PM
  5. Creating a *Good* Custom Message Box
    By Jerimiah33 in forum Forms
    Replies: 1
    Last Post: 11-09-2005, 04:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums