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

x
?
Solved

Linking 3 command buttons together

Posted on 2003-12-07
9
Medium Priority
?
228 Views
Last Modified: 2010-08-05
In my program I have 3 command buttons.  Basically what I would like to know is the coding used to have the program immediately start the second "process" after the first one has been completed.  When the first task is completed you get a "All Done" msgbox and then the user goes back to the main page and clicks on "Step 2" then when that task is done, the user clicks on "Step 3".  Is there anyway to make this a "single click" reality??

Thanks!
0
Comment
Question by:johnqtr
9 Comments
 
LVL 5

Expert Comment

by:jayeshshah
ID: 9892612
in that case after the 1st process is complete then call the click event of the 2nd button and accordingly call the click even of the 3rd button ... something like below

Private sub Command1_Click()
    ..... some code here

    Command2_Click
    Command3_Click

end sub


Private sub Command2_Click()
   ..... some code here
end sub

Private sub Command3_Click()
     ..... some code here
end sub



This code would work in case the events are coded in the same form... in case they are in different forms then make the events public and then call then using the form and the event.
Like For e.g. you have 3 forms main, form1 and form2

Main is having Command1 and form1 is having Command2 and form2 is having Command3

You would have to write the code as below


'''' Main
Private sub Command1_Click()
    ..... some code here

    Form1.Command2_Click
    Form2.Command3_Click

end sub

''''''''' form1
Private sub Command2_Click()
   ..... some code here
end sub

''''' form2
Private sub Command3_Click()
     ..... some code here
end sub


k'Regards

Jayesh
0
 

Author Comment

by:johnqtr
ID: 9892636
Thank you for the fast reponse!  

Wouldn't all the functions happen at once using this code or would the second process only begin when the first is finished?
0
 

Author Comment

by:johnqtr
ID: 9893053
I tried the code and all 3 functions happen at the same time.  I will continue to mess with it though.

Thanks!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 9893213
well couldn't you make command1 call command2, and then make command2 call command3 after its done?
0
 

Author Comment

by:johnqtr
ID: 9893249
I tried that, but no luck.  I'll continue to look at it.

Thanks
0
 
LVL 4

Accepted Solution

by:
learning_t0_pr0gram earned 1000 total points
ID: 9893292
it works for me when i tried it.. all 3 didn't go together..

i made a little test and heres what i had:

Private Sub Command1_Click()
Inet1.OpenURL ("www.yahoo.com")
Label1.Caption = "Complete"
Call Command2_Click
End Sub

Private Sub Command2_Click()
Inet1.OpenURL ("www.google.com")
Label2.Caption = "Complete"
Call Command3_Click
End Sub

Private Sub Command3_Click()
Inet1.OpenURL ("www.hotmail.com")
Label3.Caption = "Complete"
End Sub


and there is a pause between when they go turn into "Complete"
0
 

Author Comment

by:johnqtr
ID: 9893310
Maybe that's the problem, I didn't put the word "Call" before the Command3_Click for example.  I was writing it like this.

frmMain.Command2_Click

Everytime I got a "Method or data" error.

Hold on, I'll try it.



Okay, works fine!  Thanks for the help!

0
 
LVL 4

Expert Comment

by:learning_t0_pr0gram
ID: 9893318
no problem, happy i could help.
0
 
LVL 1

Expert Comment

by:sonikthomas
ID: 9895163
Private sub Command1_Click()
    your code...
    Command2_Click
end sub
Private sub Command2_Click()
    your code...
    Command3_Click
end sub
Private sub Command3_Click()
    your code...
    msgbox "completed"
end sub
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

824 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