locked
Code for different versions of Access in one MDE RRS feed

  • Question

  • Hello,

    I still do most (well, all) of my development work in Access 2003.  I have a number of users of my databases who might be using any one of Access 2003, 2007, and 2010.  So far this has worked out well using either an Access 2003 format .mdb or .mde file.  Now I feel like I would like to neaten things up a bit and minimize or hide the ribbon for Access 2007 or 2010 users in some instances but still use the same .mdb or .mde file in all versions of Access 2003 and above (even though 2003 does not include the concept of the ribbon).  In other words I would prefer not to have to maintain multiple versions of my application yet still be able to make the ribbon go away on occasion.  Is this possible, perhaps using compiler directives?  Thanks.

    Bruce

    Tuesday, September 11, 2012 8:02 PM

Answers

  • Bruce

    That is exactly what I do. As long as you deploy an MDE you can successfully hide the ribbon.

    Private Sub ShowHideRibbon(bolShowRibbon As Boolean)
    'Purpose  : Shows or hides Ribbon depending on Boolean argument.
    '           Can be run in versions older than 2007 with no ill effects.
    'DateTime : 4/11/2011 08:03
    'Author   : Bill Mosca
    'Requires :
        On Error Resume Next
        'Hide or restore ribbon in versions 2007+.
        If bolShowRibbon = True Then
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
        Else: DoCmd.ShowToolbar "Ribbon", acToolbarNo
        End If
    End Sub

    Note how I used "On Error Resume Next". Since there is no "Ribbon" Toolbar in 2003 the error is ignored.

    I just call the routine from the startup form's Load event.


    Bill Mosca
    http://www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    • Proposed as answer by KCDW Tuesday, September 18, 2012 9:25 PM
    • Marked as answer by Dummy yoyo Wednesday, September 19, 2012 2:42 AM
    Tuesday, September 11, 2012 8:20 PM

All replies

  • Bruce

    That is exactly what I do. As long as you deploy an MDE you can successfully hide the ribbon.

    Private Sub ShowHideRibbon(bolShowRibbon As Boolean)
    'Purpose  : Shows or hides Ribbon depending on Boolean argument.
    '           Can be run in versions older than 2007 with no ill effects.
    'DateTime : 4/11/2011 08:03
    'Author   : Bill Mosca
    'Requires :
        On Error Resume Next
        'Hide or restore ribbon in versions 2007+.
        If bolShowRibbon = True Then
            DoCmd.ShowToolbar "Ribbon", acToolbarYes
        Else: DoCmd.ShowToolbar "Ribbon", acToolbarNo
        End If
    End Sub

    Note how I used "On Error Resume Next". Since there is no "Ribbon" Toolbar in 2003 the error is ignored.

    I just call the routine from the startup form's Load event.


    Bill Mosca
    http://www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    • Proposed as answer by KCDW Tuesday, September 18, 2012 9:25 PM
    • Marked as answer by Dummy yoyo Wednesday, September 19, 2012 2:42 AM
    Tuesday, September 11, 2012 8:20 PM
  • Most of our db's hide the ribbon in the Autoexec Macro.

    Macro calls the functions, Action=RunCode, ap_ShowRibbon

    The Function is in a Standard Module apCodes

    Function ap_ShowRibbon()

    DoCmd. Showtoolbar "Ribbon", acToolbarNo

    Exit Function


    Chris Ward

    Tuesday, September 11, 2012 8:25 PM
  • Hi Bill,

    Didn't see your post till after mine was in.

    Like your code!


    Chris Ward

    Tuesday, September 11, 2012 8:26 PM
  • Here is a great source for doing many things with Ribbons

    Chris Ward

    Tuesday, September 11, 2012 8:36 PM
  • Thanks, Chris.

    Bill Mosca
    http://www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

    Tuesday, September 11, 2012 9:36 PM