Solved

Linking 3 command buttons together

Posted on 2003-12-07
9
225 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

751 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