-----Original Message-----
Albert,
Apparently, the menus must be MDI style.
Yes, unfortunately, all of office (word, Excel, and ms- access) for a very
long time has the mdi style (I think its been this way for at least 10 years
now...a very long time!!). And, of course the apple Mac is still that way
today in terms of forcing the menu bar at the top.
So, we are kind of stuck with this. However, it is not so bad, since all
users are so familiar due to most people being exposed to word, and excel
(both these products are likely the most popular software products in the
world, and they are mdi).
How would I
load/unload a custom menu onto the menubar depending on
which form is loaded (i.e. each form has it's own custom
menu items).
All you do is specify the menu in the forms "other" tab.
If you do this, then all the menu bar switching is totally automatic, and
requites no code. (if the focus changes, then the menu bar will change
also).
(you need to setup your own main "default" bar for this to work).
Also, I would want public functions on the
form to be invoked.
Yes, this is why I mentioned as follows::
Remember there is a bug if you use the full forms
qualifier in menu button
code, so do NOT qualify function name with the forms.
What the above means is that any function you define in a forms module as
PUBLIC
will be picked up. So, for example if you have a menu option to delete code,
you
could call
Public Function MyDelete
In the menus's on-action, you place:
=MyDelete()
The beauty of the above system is that the current form with the focus will
have
its public function MyDelete run (in the forms code). And, if you don't have
a
function in the form, then a public function in a star module will run!
(this is great!!).
form, then as mentioned,
you can simply place the code into the forms module code (as a public
function in the forms module) In this case there is NO need to pick up
the active screen...and you can use "me." qualifier (as you always used
for button code)..
When I statically define the menu,
I won't successful invoke a public function on the
form.
If the form is loaded, and the function is defined as public, then
the function will (should) run. If the form is NOT loaded, OR YOU
have a function with the same name in a standard module, then
it will be run! (so, if form does not have the function name, then
the function in a standard module is run, or if the form is NOT
loaded, then again, the function in a standard module will run).
Access can't find the function if the form isn't loaded
and if it is loaded, then an ActiveX Control Licensing
error is displayed when the menu item was selected.
That don't seem right????
Try downloading the following example of mine that has a menu bar. It is the
3rd example here:
http://www.attcanada.net/~kallal.msn/msaccess/DownLoad.ht m
Try the above..and see how it works...
The onAction value I defined was:
=Forms![Download_Supplier_Data].cmdSubTest_Click()
You did not read carefully what said in the previous post, I will repeat::
Remember THERE IS A BUG if you use the full forms
qualifier in menu button
code, so do NOT qualify function name with the forms
You need to use:
=cmdSubTest_Click()
However, I am betting that the above is not defined as public, and further I
am betting that the above is NOT a function
(it has to be a function).
If you are tying to duplicate existing buttons, then create a public
function. You could call it MyTestClick(), and use for the on action:
=MyTestClick()
(again, I stress to NOT use the forms qualify, as it will not work!).
And, your public function in the forms module could be :
Public Function MyTestClick()
Call cmdSubTest_Click()
End Function
good luck!!
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn
.