Solved

Linking 3 command buttons together

Posted on 2003-12-07
9
224 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

830 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