"PeteCresswell" <(E-Mail Removed)> wrote in message
news:7e892f59-4578-4d1a-a164-
>Just a quickie: Do you have any apps where you have just one menu/
set of menus (I'm not sure of the proper syntax...) and use the same
menu/set of menus for each and every screen?
The above is actually a really great question.
I don't use the same set of menus for in each and every screen, but I can
say in an applications where say I have lots of forms, I might have 3 or 4
major forms with a speical featuress. in other words and most applications
would use the wind up with one form that has quite a bit code and as a
significant amount of heavy lifting in terms of the application features.
this form will likely have a custom menu built just for that form, and
remember I tend to use the drag and drop ability of access to build those
custom menus, I don't use code. furthermore for these menus, I always use
the other property sheet of the form to set what custom menu is to be
displayed. the reason for this is very simple, I want different forms when
they show or the user has several forms open at the same time, simply
bringing the focus to different forms what automatically switch the menu
bars for you without any coding. so when possible, I do use the other
property sheet to set what menu is going to be displayed for a given form.
So, now, given the above, your question was to lay off to specify the same
menu bar for many forms?
In the above I mention we have 3-4 very rich customized forms, but the
application might have another 25 simple basic forms that has for the most
part just basic data entry features on the form. In these cases almost all
these forms actually have the same menu bar specified. That menu bar will
have the basic "edit/cut/paste".
Here is some screen shots:
Just take a quick look at 1st screen shot (custom menu) and then the LAST
one..that is a menu bar I use for almost every other form in the applcaion.
Here is anohter custom menu bar with the delete option:
http://www.kallal.ca/ridestutorialp/drivers.htm
The last screen shot shows a simple menu bar.
One last tip:
All of my custom menu bars tend to run VBA code in the appropriate form. So,
all my forms have a routine called
Public function MyDelete()
In the above when the user selects the option to delete records in the
custom menu bar, the code for the delete which run will be from the form
that has the focus. If the form that has the focus does not have this
routine, then a standard module is searched and that routine is then run.
What this means is that for ten forms I can have a global catch all delete
routine that is generic and works for almost all forms when they choose
edit-->delete reocrd.
For the one special form that's completely different and has to check
special things such as child records etc, or perhaps certain information
that does not allow deletion of the record, then I simply place the special
deletion code inside of the forms code module and that function will run.
So the above in a nutshell is why you can use one typical custom menu for
most all your forms or a at least vast majority of them. And, you can have
different code run for the custom menu by simply placing the code in the
form's code module as opposed to a standard regular module .
Keep in mind you never place/use the forms qualifier in the on-action. so,
just use the function name in the on-action like:
=MyDelete()
The above will then run a public function in the current format has the
focus, and as mentioned if the current form doesn't have that routine called
mydelete(), then that same name is run from a standard code module.
Essentially what this means is then you can code all of your features for
your menu bar in a global module for "most" of the forms that are standard,
and for the few exceptions, put the same function names and speical code in
the forms code module....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)