Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Seattle, WA

    Unanswered: How do you restore menus with code?

    I am new at this, but hopefully I'm doing this correct.
    I have been building a db in Access 2000 for managing data ove a
    ten year period. The form is complicated with internal checks on
    data entry and various access levels. I built a switchboard that
    controls access to various functions, and basically turned off all the
    menu and toolbars in the startup. My problem is this. When the
    Admins check into their section, I want to turn full functions back on.
    I can get the Database Window back with

    RunCommand.accmdWindow Unhide

    But how do I get the menus and toobars back? I assume I access
    them through a collection, I have tried

    Database.MenuRestore (and some things similiar)

    but this calms there is no object. I'm sure that this is the right
    direction, but where are the menus, and how do I restore and
    close them with VB code?
    Mark Redlin

  2. #2
    Join Date
    Oct 2003
    Check with your help file. I pulled this from access97 help under Showing Menus:

    Sub SetStartupProperties()
    ChangeProperty "StartupForm", dbText, "Customers"
    ChangeProperty "StartupShowDBWindow", dbBoolean, False
    ChangeProperty "StartupShowStatusBar", dbBoolean, False
    ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
    ChangeProperty "AllowFullMenus", dbBoolean, True
    ChangeProperty "AllowBreakIntoCode", dbBoolean, False
    ChangeProperty "AllowSpecialKeys", dbBoolean, True
    ChangeProperty "AllowBypassKey", dbBoolean, True

    End Sub

    Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
    Dim dbs As Database, prp As Property
    Const conPropNotFoundError = 3270

    Set dbs = CurrentDb
    On Error GoTo Change_Err
    dbs.Properties(strPropName) = varPropValue
    ChangeProperty = True

    Exit Function

    If Err = conPropNotFoundError Then ' Property not found.
    Set prp = dbs.CreateProperty(strPropName, _

    varPropType, varPropValue)
    dbs.Properties.Append prp
    Resume Next
    ' Unknown error.
    ChangeProperty = False
    Resume Change_Bye
    End If
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts