Problem with Popup menus in Access

  • Thread starter Thread starter bpearson
  • Start date Start date
B

bpearson

I have a query about displaying a popup custom menu bar in Access 2003.
Well, by query what I mean is that I can't get it to work ...


I have created the new CommandBar to drop down off the main menu. [It's
effectively a popup menu plus cascading sub-menus to open most of the
screens within the application.] This all works fine.

I then want to display the same menu as a popup from various other
places within the app. This just doesn't seem to want to work at all.

My code is effectively as follows ...

Dim MyCmdBar as CommandBar

Set MyCmdBar = CommandBars("My main
cmdbar").Controls("&Screens").CommandBar.Controls("Other screens
....").CommandBar

MyCmdBar.ShowPopup

When I call this code from a command button on a form, I get the error
message "Method 'ShowPopup' of Object 'CommandBar' failed".

However if I insert the line

MsgBox Str$(MyCmdBar.type=msoBarTypePopup)

in my code it displays the answer 'True', which suggests to me that it
is (a) a valid CommandBar object and (b) it is of a type which supports
the ShowPopup method.


Any ideas?



Brian Pearson
Mace Limited
London
 
Albert

Thanks for your reply. I must say I hadn't realised there were separate
classes of popup menu, those attached to menubars and freestanding
ones: I thought there was just a single (msoBarTypePopup) type.

It does seem very wasteful of resources to have to duplicate an entire
menu structure (in this case approaching 200 items) just to make the
menu appear in two different circumstances.

I guess though that this is what I'll have to do.
 
Back
Top