Solved

Special Menu Bar not in Macro

Posted on 2000-04-14
13
393 Views
Last Modified: 2012-06-27
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?

Thanks,

Mac

0
Comment
Question by:MacRena
  • 7
  • 6
13 Comments
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
When you create command bars in Access 97 they are stored in system table called MSysCmdBars
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Ah-Ha.  but how do I look at the design?
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Here is the table design:

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

TbName = Text
     contains the word "Form"

Mean anything to you?

Mac
0
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
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.  
0
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
I spoke too soon.  See the online help references for CommandBar Controls Collection Object.  You can build command bars in code using this collection.
0
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
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
    Else
        MsgBox "Invalid CommandBar Name"
    End If
End Sub
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 4

Author Comment

by:MacRena
Comment Utility
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.

Mac
0
 
LVL 14

Accepted Solution

by:
mgrattan earned 20 total points
Comment Utility
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.
0
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
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.
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
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.

Mac
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
mgrattan,

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

***************************************

Option Compare Database
Option Explicit

Global DatPath As String
Global SrcDB As DATABASE

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.

Mac
0
 
LVL 14

Expert Comment

by:mgrattan
Comment Utility
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.
0
 
LVL 4

Author Comment

by:MacRena
Comment Utility
Yes!  Exactly right!  Thank you!  
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now