Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Subs from within a Sub 1

Status
Not open for further replies.

DerickD

IS-IT--Management
Sep 19, 2002
93
LU
Hi All,

I have a form with 4 buttons. You need to press the buttons in order to get the correct result. I could run all the code on one button but I split it up to make it easier to administer. (and make it look more technical and complicated for the end users :) )

What I also want is one BIG button that runs each of the buttons 'Private Sub''s in order.

e.g. :

Code:
 Run(Private Sub Btn_Import_Click)
Run(Private Sub Btn_Append_Click)
Run(Private Sub Btn_Report_Click)
Run(Private Sub Btn_Print_Click) [\code]


I have seen this done and know it is a simple function, but I do not know which one and can not find any thing in help...can you help...
 
Hi

In the on click event of you 'big' button just put:

Private Sub BigButton_Click
Btn_Import_Click
Btn_Append_Click
Btn_Report_Click
Btn_Report_Click
End Sub Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Why not just put each of your subs in a Standard Module or a Class Module?
Then you just call them using your buttons Click event.
ie.
Sub btn_SuperButton_Click()

Run ImportSub
Run AppendSub
Run PrintSub
Run ReportSub

End sub

Or you could add a "do all" sub to the module that contains the subs above. That would hide a bit of the complexity - so you don't need to worry about running them in the correct order etc.

Greg

 
Or just do what Ken Reay said! Guess you don't need those Runs when you call the subs either.
 
Thanks KenReay (Programmer).

That was exactly what I was looking for.......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top