If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Reusing Command Buttons
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. |
#2
|
|||
|
|||
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. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "roccogrand" wrote in message ... 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. |
#3
|
|||
|
|||
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/AlbertKal...erFriendly.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 he http://www.members.shaw.ca/AlbertKal...000000005.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... -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada http://www.members.shaw.ca/AlbertKallal |
Thread Tools | |
Display Modes | |
|
|