Solved

Linking 3 command buttons together

Posted on 2003-12-07
9
219 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now