Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calling Access Event Procedures

Posted on 2011-09-19
6
Medium Priority
?
226 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 1000 total points
ID: 36562208
yes!

private sub newBtn_click()
    btn1_click
    btn2_click


end sub
0
 
LVL 10

Assisted Solution

by:VTKegan
VTKegan earned 1000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

772 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