Calling Access Event Procedures

Posted on 2011-09-19
Last Modified: 2012-05-12
Hi Experts.

I have a form in Access that has about 2 dozen command buttons that each have an event procedure to run when clicked.  I would like to add one more button that would run the all the event procedures from all the buttons.  Is there a way to call these other 'on click' button events from the new button?

Thanks in advance.

Question by:JJINFM
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 250 total points
ID: 36562208

private sub newBtn_click()

end sub
LVL 10

Assisted Solution

VTKegan earned 250 total points
ID: 36562211
You can just simply call the btnAction1_OnClick() event in the code of the all button like below

Private Sub btnActionAll_Click()


End Sub
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36563492
You had better make sure you have some iron-clad error handling and/or rollback functionality in place...
In case one of the subs fails...
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

LVL 26

Expert Comment

ID: 36564212
<You had better make sure you have some iron-clad error handling and/or rollback functionality in place...
In case one of the subs fails...

True dat!

Even if your individual buttons have error handling, one of them failing may not bomb your mega-call, and if there are dependencies between these actions that could be bad
Copying and pasting the code from each button into a new procedure, with error handling might be prudent.
Building one big procedure that the 20 buttons call, passing in a parameter, that has a Select Case structure to deal with the piecemeal or mega-press might also be good.

But yes, they can all be called together like the first two posters have written
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36564282
Also some back ground would be nice...

<I have a form in Access that has about 2 dozen command buttons>
24 button on one form?

Why the need to do this?
What are these codes doing?

Just curious... case there is a more efficient approach...

Author Closing Comment

ID: 36576064
Thank you both.

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question