Solved

Calling Access Event Procedures

Posted on 2011-09-19
6
218 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 119

Accepted Solution

by:
Rey Obrero 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now