• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 67
  • Last Modified:

How do I create a custom menu bar?

Hi Experts,

I'm trying to create a custom menu bar to have this avail when users right click on any place in a form.
See attached what currently comes up.
My question is how do I add something to this list?
Or at least, is there any way I can add stuff to the Custom 1 menu bar displayed there?
Tried doing by customize but didnt see Custom 1 displayed there..

FYI- I'm designing this in Access 2003, but users will have A2007+ runtime in their pc.
Untitled.png
0
bfuchs
Asked:
bfuchs
  • 8
  • 6
  • 2
1 Solution
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
hi Ben,

here are a couple articles by Dale Fye that should be helpful:

Understanding and using CommandBars (ShortCut menus), Part 1
https://www.experts-exchange.com/articles/11333/Understanding-and-using-CommandBars-ShortCut-menus-Part-1.html

Understanding and using CommandBars, Part II (Creating your own)
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12904-Understanding-and-using-CommandBars-Part-II-Creating-your-own.html

have an awesome day,
crystal
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Let's keep this simple.  Just get Dale's Right Click Shortcut Tool.
I helped him beta test this for more that a year. I use if frequently.
No code to write. Completely blows away the original Microsoft Custom Command Bar tool (which is deprecated).

http://dev-soln.com/index.php/shortcuttool

Just do it and thank me later.
1
 
bfuchsAuthor Commented:
@Crystal,
(from that link)

In Access versions prior to 2007 there was a convenient method for creating shortcut menus, but that method was eliminated in Access 2007.
This link seems to refer to A2007, while I'm basically looking for the "Convenient method" that was avail in 2003..Since I've never use it, would like some hints how to get started..

@Joe,
If you say that is simpler than the Access build in tool, I will try that..

Thanks,
Ben
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
well ... maybe I am misunderstanding what you are looking for

"FYI- I'm designing this in Access 2003, but users will have A2007+ runtime in their pc."
A2003?  But the image is A2007, right?
You can still create custom right click menus in A2003 ... and even if you convert an MDB to ACCDB (including RT) ... those custom right click menus will still be there in A2007. BUT ... within the A2007 environment itself, there is no tool to modify those menus (only via code). Hence ... enter Dale's shortcut tool.

??
0
 
bfuchsAuthor Commented:
@Joe,
A2003?  But the image is A2007, right?
No, guess you have already forgotten how Access 2003 looked like-:)

Anyway what I'm looking is for simply introduction in short of how you start creating menu bars in 2003 the easiest manner (at least for now..).

I never used this before, however now since we upgraded our Office to 2016 (all besides Access), everything started to get slow in my app..and I was told to use runtime as a fix, but there comes the problem that runtime does not have right click menus avail..

Detailed above what was already tried and failed..

Thanks,
Ben
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Wow ... I guess so, lol.
OK ... so if you are in A2003 ... Dale's tool cannot be used.
So ... in A2003 ... (it's been AWHILE) ... and I do not have an A2003 system so I cannot do screenshots (sadly), but you s/b be able to right click (no pun) over a blank area of a menu bar (I think) ... and select Customize.  Then to get to the Right Click menus ... you have to select Shortcuts in the list.  This I think opens up a separate floating bar of existing right click menus ... and from here ... you can customize existing menus or create a new one from scratch. Sorry, I am REALLY guessing here.  I used to do this ALL the time - every app. But now I use Dale's tool in A2010/2013/2016 ACCDBs.

Crystal ... do you still have A2003 somewhere ??

BEN ... try Googling 'create custom right click menus in Access 2003' ... there is a load of hits.  Try to find one with screenshots using the Customize Dialog.
0
 
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
Joe, not too accessible, but I dug up some code ...

hi Ben,

I really like the way the custom toolbars used to work ... I used them a lot.  The good news is that when the database is converted to 2007, they convert as well, if I recall right (I don't think this code run in 2007 though).  However, I will tell you it is a good idea to develop in the same version as your users. Access 2007 uses the ribbon, not toolbars.

 this is for Excel, but Access would be similar ... I'll keep my eye open for an old database with custom menubars too
Sub RemoveMenubar(psToolBarName As String)
'strive4peace
    On Error Resume Next
    Application.CommandBars(psToolBarName).Delete
    On Error GoTo 0
End Sub

'===========================================
Sub CreateMenubar()
'strive4peace

   Dim i As Integer _
      , sToolBarName As String

   Dim asMacroName As Variant _
      , asCaptions As Variant _
      , asTooltips As Variant

   sToolBarName = "MyToolBarName"
   
   'remove toolbar if it is already there
   Call RemoveMenubar(sToolBarName)
   
   asMacroName = Array("FirstMacro", "SecondMacro")
   asCaptions = Array("First Caption", "Second Caption")
   asTooltips = Array("First Tip", "Second Tip")
      
   With Application.CommandBars.Add
      .Name = sToolBarName
      .Left = 100
      .Top = 100
      .Protection = msoBarNoProtection 'msoBarNoProtection=0
      .Visible = True
      .Position = msoBarFloating 'msoBarFloating=4
      
      For i = LBound(asMacroName) To UBound(asMacroName)
         With .Controls.Add(Type:=msoControlButton) 'msoControlButton=1
            .OnAction = "'" & ThisWorkbook.Name & "'!" & asMacroName(i)
            .Caption = asCaptions = (i)
            .Style = msoButtonIconAndCaption 'msoButtonIconAndCaption=3
            .FaceId = 72 + i
            .TooltipText = asTooltips(i)
         End With
      Next i
   End With
End Sub

Open in new window

I can't test this right now ... so hope if it doesn't work quite right, you can fix it ~

have an awesome day,
crystal
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Crystal ... not looking for code.
Looking for screen shots of the original Customize Dialog ... which seem to be in the link above.
0
 
bfuchsAuthor Commented:
Hi experts,

not looking for code.
Right, my main point is to use the simplest (fastest) way to accomplish it, will deal with enhancements later..

... which seem to be in the link above.
Which link contained screenshots of A2003?

Thanks,
Ben
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
wow ... that is ODD.  No link.  Not sure what happened.
let me see if I can find it again ...
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
OK HERE it is .....
0
 
bfuchsAuthor Commented:
Hi Joe,

See attached how I have tried (custom 2), any idea why doesn't it show up as an option to select (see 2nd attachment drop down)?

Thanks,
Ben
Untitled.png
Untitled.png
0
 
bfuchsAuthor Commented:
See attached how custom 2 looks like.
This is what I want should appear when user right clicks anywhere in the form.

Thanks,
Ben
Untitled.png
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
OK I think you have to click on Properties then change the Type to Popup ...
And BTW ... to add/exit that Bar ... you can click on Shortcut Menus ... which will bring up a floating (I think) bar ... the you cab add/remove items.
0
 
bfuchsAuthor Commented:
Great, this is the piece I was missing all the way along.
Thank you!
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You're welcome.
Keep in mind if you move to ACCDB format. you will want to get Dale's tool, which is MUCH easier to use ... basically the old tool on steroids and a lot more !
0
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.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 8
  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now