How to build meu bar with drop down by code

I

Irshad Alam

Is there a way to make a menu bar with drop down with some of the form name
by the help of code.

The same I am doing it manually through Views-ToolsBar-Customise and
dragging and making it.

As there is several user, I am trying to provide them seprate seprate menu
bar (as the all the form will not be provided to them - it will be depending
on their department).

If I can create a code which will make a common menu bar upon opening the
mdb, it can solve my problem

Please advise

Regards

Irshad
 
G

Graham R Seach

Irshad,

You can create toolbars in code, and you can do it at runtime too, but given
you're not an experienced developer, it won't be a trivial exercise. If all
you really want to do initially is to display a common toolbar when the
application is launched, then create the common toolbar, then specify it in
Tools | Startup | Menu Bar.

Make sure to untick [Allow Built-in Toolbars].

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
R

Rick Brandt

Irshad said:
Is there a way to make a menu bar with drop down with some of the
form name by the help of code.

The same I am doing it manually through Views-ToolsBar-Customise and
dragging and making it.

As there is several user, I am trying to provide them seprate seprate
menu bar (as the all the form will not be provided to them - it will
be depending on their department).

If I can create a code which will make a common menu bar upon opening
the mdb, it can solve my problem

Please advise

Not sure what you mean by "drop down". Something like this?


Sub AddMenuCombo()

Dim mnu As Object
Dim combo As Object

Set mnu = CommandBars("MyToolBar")
Set combo = mnu.Controls.Add(Type:=4)

With combo
.AddItem "First Item", 1
.AddItem "Second Item", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 0
End With


End Sub
 
I

Irshad Alam

Dear Friends,

By the dropdown menu, I meant same like File menu has its dropdown/submenu
like - new - open etc.

I tried the below code, but failed, its produces the error on the first line.

Please advise.

regards

Irshad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top