Solved

Calling Access Event Procedures

Posted on 2011-09-19
6
220 Views
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.

JJ
0
Comment
Question by:JJINFM
6 Comments
 
LVL 120

Accepted Solution

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

private sub newBtn_click()
    btn1_click
    btn2_click


end sub
0
 
LVL 10

Assisted Solution

by:VTKegan
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()

btnAction1_Click()
btnAction2_Click()
etc...

End Sub
0
 
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...
0
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

by:Nick67
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
0
 
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...
...in case there is a more efficient approach...
0
 

Author Closing Comment

by:JJINFM
ID: 36576064
Thank you both.
0

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