Reusing Command Buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create an application that looks like a website with the same
command buttons in the same positions on each main form. What are the
strategies for doing this without copying the same On_Click events into every
form?

There are ten buttons that I want on every form. To the right of these
standard buttons are context sensitive buttons. The standard buttons open
forms that I am calling my portals (10 of them). Each portal has anywhere
from 5 to 25 command buttons that open forms and reports.

Thanks.
 
The key issue here is keeping maintenance to minimum. My preferred approach
would be to put the code for the buttons into functions a standard module.
Then set their On Click property to the function name. You can then copy the
buttons onto other forms, and this property is copied. If your code needs to
be abe to distinguish which form called the code, you could set the On Click
to:
=MyFunc([Form])
and set up the function as:
Public Function MyFunc(frm As Form)
and then you can use "frm" in the procedure whereever you would have used
"Me".

Another approach would be to put the buttons onto a subform, and place the
subform on each form. This is less efficient on resources, and IMHO no
simpler to maintain.
 
Well, a really good way is to dump the use of buttons, and make a custom
menu bar. After all, most windows software does have menu bars, and users
would find this nice.

You can read about my thoughts on this, and note the screen shots of
ms-access using menus bars in the following:

http://www.members.shaw.ca/AlbertKallal/Articles/UseAbility/UserFriendly.htm

And, the other approach is to place all the buttons on a sub-form, and then
just drop in this sub-form into any form that needs the buttons. Thus, you
get a instant re-useable component that you just drop in. I mention the idea
of making a re-usable form here:

http://www.members.shaw.ca/AlbertKallal/Articles/fog0000000005.html

And, if you don't use a sub-form, you could use a popup form that stays
always on top, and again, the one form could then work for all forms...
 
Back
Top