Special Menu Bar not in Macro

Hello Experts,

Here's one for your crystal ball.

I have a database program that uses a Custom Menu.  Only I can't find where it is comming from.   I know how to create one from a macro, but there are no macros here.

Can anyone tell me how this Special Menu Bar may have been created in Access97?



Who is Participating?
mgrattanConnect With a Mentor Commented:
Yes, it appears that a custom command bar is being displayed and all others are being suppressed.  The suppression is probably occuring in the Startup process.  You can prevent the Startup process from being triggered by either holding down the Shift key while opening the MDB or by renaming the Autoexec macro to something else.  After you have prevented the Startup routine from running you can go to Tools | Startup and see if this is where the menus/toolbars are being disabled.  You don't need to enable them, however, if your intent is to just make some changes to the database using the default toolbars (such as the Form Design button) and you want the users to not have access to those buttons.  You will have access to full menus and toolbars just by preventing the Startup routine from running.  You will also be able to change the toolbar design at that point by right-clicking on the toolbar area and choosing Customize and then selecting the Form toolbar.
When you create command bars in Access 97 they are stored in system table called MSysCmdBars
MacRenaAuthor Commented:
Ah-Ha.  but how do I look at the design?
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

MacRenaAuthor Commented:
Here is the table design:

Grptbcd = OLE Object
     contains the words "Long Binary Data"

TbName = Text
     contains the word "Form"

Mean anything to you?

TbName is simply the name you assigned to the command bar.  As for the design, you got me!  I don't think you can actually get to it since it's not in any of the listed Collections in Access.  
I spoke too soon.  See the online help references for CommandBar Controls Collection Object.  You can build command bars in code using this collection.
I realized that you could manipulate the command bars after I initially clicked that danged Submit button because I have actually used the Collection in an application I built last year.  In that application, I used code to loop through the menu items in a command bar and disable the ones that did not apply to the current user.  Not only can you enable/disable controls but you can add and delete controls as well.

Here's a function that tells you which controls are in the command bar that you pass:

Sub CommandBarInfo(strCBBarName As String)
    Dim cbr As CommandBar

    On Error Resume Next
    Set cbr = CommandBars(strCBBarName)
    If Err = 0 Then
        With cbr
            MsgBox "The command bar named '" & .Name & "' contains " & _
            .Controls.Count & IIf(.Controls.Count = 1, " control and ", _
            " controls and ") & IIf(.BuiltIn, "is", "is not") & _
            " a built-in toolbar", vbOKOnly, "'" & _
            .Name & "' Information:"
        End With
        MsgBox "Invalid CommandBar Name"
    End If
End Sub
MacRenaAuthor Commented:
Searching for the word Commandbar, there is no instance of it in this code.

I told you you'd need a crystal ball.

Here's something - in the AutoExec code there is a line

    DoCmd.ShowToolbar "Form", acToolbarYes

That's it, isn't it?

But how do I look/change the design?

Could this one be an intrinsic Access default Commandbar?

When I REM out the line in AutoExec it acts exactly the same.  That also doesn't explain why the standard "Form View" toolbar is not there. (the one with the "Design View" icon - to get that I need to right-click off the page)

Somehow this program supresses "Form View" and puts up a default "Form".  I tried changing the options, but there isn't an option for that.

I can't figure out how this is being done.

By the way, since you weren't able to find CommandBar in your search through the database that just indicates that the custom toolbar/menu is not being manipulated via code.  The database designer simply created a new toolbar/menu by right-clicking on the toobar area and selecting Customize and the selecting New and adding buttons to it from the Customize dialog.  No magic going on here, just basic toolbar customization and suppression of the default toolbars via the Startup routine.
MacRenaAuthor Commented:
Thanks, mgrattan.

I didn't figure out why the standard "Form Design" menu is supressed, but I know a lot more than I did a while ago.

Thank you very much.

MacRenaAuthor Commented:

I didn't see your last entry - here's the entire Startup Module:


Option Compare Database
Option Explicit

Global DatPath As String

Function AutoExec()

    '--- Check to see if Tables are correctly attached
    Dim x As Integer
    x = CheckTables()

    '--- Enter the path of program's data files
    Dim mydb As DATABASE, MyDef As TableDef, Length As Integer, CompanyName As Variant
    Set mydb = CurrentDb()
    Set MyDef = mydb.TableDefs("Orders")
    Length = Len(Trim(MyDef.Connect))
    DatPath = Right(Trim(MyDef.Connect), Length - 10) ' Remove the ;DATABASE= from the ConnectString
    Set SrcDB = DBEngine.Workspaces(0).OpenDatabase(DatPath)
    '--- Turn off the action query warnings
    Application.SetOption "Confirm Action Queries", False
    Application.SetOption "Confirm Record Changes", False
    '--- Display Toolbar
    DoCmd.ShowToolbar "Form", acToolbarYes
End Function

That's all there is.  I don't see where the "Form View" toolbar is being supressed here.

On your menu bar select Tools, Startup.  That's where you should see whether the option to Allow Default Toolbars is checked or not.  If it's not checked, you will see the default toolbar on your screen when you have an object open in Design view.  If you don't have the object open in Design view then you will see only the toolbar that has been assigned to that object (form or report) in that object's MenuBar or ToolBar property.
MacRenaAuthor Commented:
Yes!  Exactly right!  Thank you!  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.