Create button to execute other buttons

opko

New member
Local time
Today, 16:48
Joined
Sep 20, 2016
Messages
1
Hello,

I am fairly new to macro's and VBA programming and do not know the difference between private sub and public sub (among a ton of other things).

My problem: I have a form with some buttons which all contain embedded macros. When I click these buttons, they execute a sequence of query's which are specified in the build-in macro expression tool. The query's are used to calculate some values from many tables.

Now I want to create a button in the same form that executes all the other buttons.

So my question is: How do I create a button which executes other buttons? I suspect this is done in VBA, but I do not know where to enter code or what code to enter.
 
do not know the difference between private sub and public sub
easy enough to google

http://stackoverflow.com/questions/...im-global-public-and-private-as-modular-field


How do I create a button which executes other buttons?
you use vba code (macro's too probably but I don't use them so can't advise)

say you have three buttons called Action1, Action2 and Both. All need code in the click event.

Code:
 Private Sub Action1_Click()
    if me.Action1.backcolor=vbred then me.Action1.backcolor=vbgreen else me.Action1.backcolor=vbred
 End Sub

  
 Private Sub Action2_Click()
    if me.Action2.backcolor=vbred then me.Action2.backcolor=vbgreen else me.Action1.backcolor=vbred 
 End Sub


 Private Sub Both_Click()
    Action1_Click
    Action2_Click
End Sub
 

Users who are viewing this thread

Back
Top Bottom