Making a dropdown menu bar? Possible? (1 Viewer)

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
In one of my forms I would like to add, if possible, a custom drop down menu bar similar to the File, Edit, View, etc... you find in any program. By drop down menu I do not mean a combo box and I also do not mean a custom ribbon or menu bar in Access itself. I am looking to create a custom one inside one of my forms. Is this possible?

If there is no such way of creating one does anyone have suggestions on how to change the appearance of a combo box to make it look like a button, then when clicked, the list appears? Or any other suggestions on how to "fake" one?
 

Trevor G

Registered User.
Local time
Today, 05:09
Joined
Oct 1, 2009
Messages
2,341
You have to look at creating menus in the macor section (add Menu) then you create command to the menu.

Then on your form you need to look at the properties and there should be an add menu (which would be the main macro name).

I know this can be done in MS Office 2003.
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
I played around with your suggestion and I was able to figure out how to make a custom right click menu, or add that same menu to the ribbon in the add-Ins tab, but what I was really looking for was creating a menu bar INSIDE of a particular form and not on the access window. Being able to create a custom right click menu gave me a simple idea on how to possibly make one, but I cant figure out how to do it, or even know if it is possible.

What if I just create a few regular old buttons and somehow attach that menu macro to those buttons, so when clicked, up pops that menu list macro. I was able to get it working when I right click the button, but is there any way to get the menu to pop up when I LEFT click the button?

In the onclick of the button I placed that macro , but I get the following error message when I click it:
"A menu bar macro can only be run if the menu bar macro name is the setting used by particular properties or options"

Any suggestions?
 

Trevor G

Registered User.
Local time
Today, 05:09
Joined
Oct 1, 2009
Messages
2,341
What about having a Label's in the form header and when you click it reveals the list of other label actions below.

Look at the attached, I am simply using some labels and then behind the labels using some basic code to open different things. It would take some working out for all of your instructions and actions but may give you another option.

Also I suppose a tree view option maybe possible.

Open the sample attached and look for a form called frmMenuSystem and then click on the label
 

Attachments

  • Test ME Today.zip
    150.3 KB · Views: 5,793

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
Thanks... I originally thought of something similar to that, but im my case it wouldn't really work. Let me explain... In my db I have a main navigational form (like a switchboard but not one). This form is small in size (about 1" high and 5"wide) and contains only 5 buttons that and I position this form as a strip across the top of my screen. Each button opens another form with "sub category" buttons, then those buttons open the related forms for data entry or viewing etc. I would like to eliminate these sub category forms, and when clicking on the main navigational buttons, the dropdown menu appears with a list of forms to open related to that button/category.
Like I said, the main navigational form is so small I have no room to place "hidded" labels that would appear when the button is clicked. (obviously I can resize the form, but it would not look right with this big blank spot under the buttons). any other suggestions?
 

Trevor G

Registered User.
Local time
Today, 05:09
Joined
Oct 1, 2009
Messages
2,341
The only other thing I can think of is creating a custom navigation category, but then you are showing the navigation payne to users.

XML is another option.

I know there is a website out there that will allow you to build your own tabs but haven't got the link at home.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:09
Joined
Sep 12, 2006
Messages
15,653
a simple tab control may help

not exactly the same, but it will let you group items/buttons in a logical manner.

I dont think you can embed a menu in a form. I am pretty sure you can have a particular menu bar associated with a single form though. Fixed, or even floating.
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
Ok, I'm resurrecting this post again. After viewing Staurt Green's link above, I found that this is EXACTLY what I was looking for, but there are problems. The instructions in the link was written for Access 2002 and below. In short they stated to just create a custom menu button (which is easily done in 2002), then do a little "tweaking", attach small code to a button, and then it works perfectly. My problem is that I have Access 2007, and we all know that it has the ribbon and doesn't support custom menu bars/buttons like previous versions do.

I searched and found a way to create custom menu bars in VBA in this link http://msdn.microsoft.com/en-us/library/aa210698(office.11).aspx, and all works well for adding a button and such to the ribbon, but I cant figure out how to use/merge my menu bar created in VBA with the code given from the databasejournal link above.

This is the code I have to create the menu bar/button:
Code:
Dim mymenubar As CommandBar
Dim newMenu As CommandBarPopup
Dim ctrl1 As CommandBarButton
 
Set mymenubar = CommandBars.ActiveMenuBar
Set newMenu = mymenubar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
newMenu.Caption = "Custom2"
Debug.Print mymenubar.Name 'Where I get the name "Menu Bar" in code below
Set ctrl1 = newMenu.CommandBar.Controls.Add(Type:=msoControlButton, id:=1)
With ctrl1
.OnAction = "= tempfunction()"
.Caption = "Test"
.TooltipText = "Just a Test"
.Style = msoButtonCaption
End With
End Sub

And the code attached to my button I want the popup menu to is:
Code:
option explicit
Public objPopup As Object
...
Private Sub Command13_Click()
    Set objPopup = CommandBars("Menu Bar")
    objPopup.ShowPopup
    Set objPopup = Nothing
End Sub

Upon click of the button i get the error:
"Method 'ShowPopup' of object 'CommandBar' failed"

I have never dabbled around with this type of coding or menu creating with VBA, so everything I posted was just copied from other sites.

Any suggestions on how to get Staurt Green's link to work in Access 2007?
 

DCrake

Remembered
Local time
Today, 05:09
Joined
Jun 8, 2005
Messages
8,632
Just out of interest, what do you want this proposed menu bar do? And why specifically do you want it when custom riboons are already available?
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
Just out of interest, what do you want this proposed menu bar do? And why specifically do you want it when custom riboons are already available?


My intended need is for an over cluttered form. I want to have, ON MY FORM, a button that I click and then displays a list of sub menus. Just as if I were to have a standard file/edit/format... menu bar INSIDE my form. Those "submenus" would open the related forms or reports for data entry/review. I am not trying to create a custom ribbon with those controls. In the end result of my DB/application the ribbon is hidden anyway.
 

DCrake

Remembered
Local time
Today, 05:09
Joined
Jun 8, 2005
Messages
8,632
Ok if thats what you want. Do these styles of menus suit your needs?





 

Attachments

  • form1.JPG
    form1.JPG
    58 KB · Views: 20,558
  • form2.JPG
    form2.JPG
    64.4 KB · Views: 20,159
  • form3.JPG
    form3.JPG
    62.8 KB · Views: 21,206

smig

Registered User.
Local time
Today, 07:09
Joined
Nov 25, 2009
Messages
2,209
I found a very nice and easy solution for this lately :)

create a combobox and put all the data you want in your "Drop Down menu"
create a button to drop down the menu.
give the combo a 0 size width and aline it to the right of the button.
set the background color of your combo as you wish.
for the button_OnClick event run the combo_DropDown event (this will open your "Drop Down Menu"
use the cobo_AfterUpdate event to set what to run for each selection.

problems: no way to have nested "menu", no way to put a group line
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
Resurrecting this post once again!!! After much searching and playing around, I got it working exactly as I needed. For anyone following this thread and also for the MANY menus I need to create, I created a database tool that will create the command bars and commands (buttons) in an easy to use GUI manner. Attached is a database with all the tools needed to create your own command bars and attach them to a button on your form, or even place them in the ribbon in Access 07. An added note though. This tool was created in Access 07 and I am unsure how it will act in older versions. Also, I'm sure there are more options available when creating command bars, but I only included the most common options and only the ones I need when creating my menus. The physical design of this may not be that professional, but If anything else this should be at least a good starting point for someone else to modify to suit their own needs. I am no expert on creating custom command bars, and mainly have to credit Staurt Greens post back on 9/17/10 for pointing me to a good starting point. Feel free to ask questions, but like I just stated, i am no expert on this, and only learned what I needed to create what I needed. Hopefully it works for anyone that needs it. Enjoy
 

Attachments

  • Menu Creator.accdb
    1 MB · Views: 3,841

DCrake

Remembered
Local time
Today, 05:09
Joined
Jun 8, 2005
Messages
8,632
At a glance it looks promising however it is not very intuative and there are a couple of errors cropping up. 8/10 for starters.
 

smig

Registered User.
Local time
Today, 07:09
Joined
Nov 25, 2009
Messages
2,209
I can't test what you did, as it's in AC2007
did you try what I suggested ove a month ago?
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
I can't test what you did, as it's in AC2007
did you try what I suggested ove a month ago?
Yes I created it in Access 07 and am unsure how it will react in other versions. I did not try what you have suggested a little whilt back, but only because I got this workin before that (for my particular database at least). I am no expert when it comes to designing and answering questions, and this is actually the first time I am even posting something to possibly help someone else and not asking for help myself. i have gotten so much help from other users here that I was anxious to post something that could possible help someone else, but probably should of debugged it more before posting. If the actual database forms do not work for you, look at the code and try to create your command bars straight from there. I recall in one of the comments I placed an address that gave good information on how to create command bars. What errors are you getting. The entire DB is in access 07 format, and I believe it will not even open on older versions. If thats the case, let me know and I can re-save the db in an older format (probably should of done that in the first place), but Like I stated earlier, I am unclear if this will work or not in older formats.

At a glance it looks promising however it is not very intuative and there are a couple of errors cropping up. 8/10 for starters.
Yeah I knew there would be errors, but like I was saying to smig above, I was just anxious to get it out there and help someone else. Everytihng I needed it for works fine, but I guess everyone out there would have slightly different uses for it, and I did not incorperate those uses into the design.
 

smig

Registered User.
Local time
Today, 07:09
Joined
Nov 25, 2009
Messages
2,209
as I use AC2003 I can't open AC2007 db
 

buratti

Registered User.
Local time
Today, 00:09
Joined
Jul 8, 2009
Messages
234
Thanks vbaInet, was just about to post the same thing, but you beat me too it. Keep me informed on how everything is working for you guys.
 

Users who are viewing this thread

Top Bottom