Solved

Linking 3 command buttons together

Posted on 2003-12-07
9
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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
Course of the Month6 days, 22 hours left to enroll

622 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